<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-5"></span><span class="hs-comment">--</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Building info tables.</span><span>
</span><span id="line-7"></span><span class="hs-comment">--</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- (c) The University of Glasgow 2004-2006</span><span>
</span><span id="line-9"></span><span class="hs-comment">--</span><span>
</span><span id="line-10"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-11"></span><span>
</span><span id="line-12"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.StgToCmm.Layout</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-13"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#mkArgDescr"><span class="hs-identifier">mkArgDescr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-14"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#emitCall"><span class="hs-identifier">emitCall</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#emitReturn"><span class="hs-identifier">emitReturn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#adjustHpBackwards"><span class="hs-identifier">adjustHpBackwards</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#emitClosureProcAndInfoTable"><span class="hs-identifier">emitClosureProcAndInfoTable</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#emitClosureAndInfoTable"><span class="hs-identifier">emitClosureAndInfoTable</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#slowCall"><span class="hs-identifier">slowCall</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#directCall"><span class="hs-identifier">directCall</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#FieldOffOrPadding"><span class="hs-identifier">FieldOffOrPadding</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#ClosureHeader"><span class="hs-identifier">ClosureHeader</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsets"><span class="hs-identifier">mkVirtHeapOffsets</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsetsWithPadding"><span class="hs-identifier">mkVirtHeapOffsetsWithPadding</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#mkVirtConstrOffsets"><span class="hs-identifier">mkVirtConstrOffsets</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#mkVirtConstrSizes"><span class="hs-identifier">mkVirtConstrSizes</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#getHpRelOffset"><span class="hs-identifier">getHpRelOffset</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span>        </span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html#ArgRep"><span class="hs-identifier">ArgRep</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html#toArgRep"><span class="hs-identifier">toArgRep</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html#argRepSizeW"><span class="hs-identifier">argRepSizeW</span></a></span><span> </span><span class="hs-comment">-- re-exported from GHC.StgToCmm.ArgRep</span><span>
</span><span id="line-30"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">


#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator">(&lt;*&gt;)</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Closure.html"><span class="hs-identifier">GHC.StgToCmm.Closure</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Env.html"><span class="hs-identifier">GHC.StgToCmm.Env</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html"><span class="hs-identifier">GHC.StgToCmm.ArgRep</span></a></span><span> </span><span class="hs-comment">-- notably: ( slowCallPattern )</span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Ticky.html"><span class="hs-identifier">GHC.StgToCmm.Ticky</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html"><span class="hs-identifier">GHC.StgToCmm.Monad</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Utils.html"><span class="hs-identifier">GHC.StgToCmm.Utils</span></a></span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Graph.html"><span class="hs-identifier">GHC.Cmm.Graph</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html"><span class="hs-identifier">GHC.Runtime.Heap.Layout</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html"><span class="hs-identifier">GHC.Cmm.BlockId</span></a></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.html"><span class="hs-identifier">GHC.Cmm</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Utils.html"><span class="hs-identifier">GHC.Cmm.Utils</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Info.html"><span class="hs-identifier">GHC.Cmm.Info</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.CLabel.html"><span class="hs-identifier">GHC.Cmm.CLabel</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html"><span class="hs-identifier">GHC.Stg.Syntax</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#PrimRep"><span class="hs-identifier">PrimRep</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#primRepSizeB"><span class="hs-identifier">primRepSizeB</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RepArity"><span class="hs-identifier">RepArity</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.html"><span class="hs-identifier">GHC.Unit</span></a></span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-66"></span><span class="hs-comment">--                Call and return sequences</span><span>
</span><span id="line-67"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span class="hs-comment">-- | Return multiple values to the sequel</span><span>
</span><span id="line-70"></span><span class="hs-comment">--</span><span>
</span><span id="line-71"></span><span class="hs-comment">-- If the sequel is @Return@</span><span>
</span><span id="line-72"></span><span class="hs-comment">--</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- &gt;     return (x,y)</span><span>
</span><span id="line-74"></span><span class="hs-comment">--</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- If the sequel is @AssignTo [p,q]@</span><span>
</span><span id="line-76"></span><span class="hs-comment">--</span><span>
</span><span id="line-77"></span><span class="hs-comment">-- &gt;    p=x; q=y;</span><span>
</span><span id="line-78"></span><span class="hs-comment">--</span><span>
</span><span id="line-79"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#emitReturn"><span class="hs-identifier hs-type">emitReturn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#ReturnKind"><span class="hs-identifier hs-type">ReturnKind</span></a></span><span>
</span><span id="line-80"></span><span id="emitReturn"><span class="annot"><span class="annottext">emitReturn :: [CmmExpr] -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#emitReturn"><span class="hs-identifier hs-var hs-var">emitReturn</span></a></span></span><span> </span><span id="local-6989586621681053287"><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053287"><span class="hs-identifier hs-var">results</span></a></span></span><span>
</span><span id="line-81"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681053286"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053286"><span class="hs-identifier hs-var">dflags</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-82"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681053284"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053284"><span class="hs-identifier hs-var">platform</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Platform
</span><a href="GHC.StgToCmm.Monad.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-83"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681053282"><span class="annot"><span class="annottext">Sequel
</span><a href="#local-6989586621681053282"><span class="hs-identifier hs-var">sequel</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Sequel
</span><a href="GHC.StgToCmm.Monad.html#getSequel"><span class="hs-identifier hs-var">getSequel</span></a></span><span>
</span><span id="line-84"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681053280"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053280"><span class="hs-identifier hs-var">updfr_off</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Int
</span><a href="GHC.StgToCmm.Monad.html#getUpdFrameOff"><span class="hs-identifier hs-var">getUpdFrameOff</span></a></span><span>
</span><span id="line-85"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Sequel
</span><a href="#local-6989586621681053282"><span class="hs-identifier hs-var">sequel</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-86"></span><span>           </span><span class="annot"><span class="annottext">Sequel
</span><a href="GHC.StgToCmm.Monad.html#Return"><span class="hs-identifier hs-var">Return</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-87"></span><span>             </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="GHC.StgToCmm.Layout.html#adjustHpBackwards"><span class="hs-identifier hs-var">adjustHpBackwards</span></a></span><span>
</span><span id="line-88"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681053277"><span class="annot"><span class="annottext">e :: CmmExpr
</span><a href="#local-6989586621681053277"><span class="hs-identifier hs-var hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; CmmType -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmLoad"><span class="hs-identifier hs-var">CmmLoad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Area -&gt; Int -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmStackSlot"><span class="hs-identifier hs-var">CmmStackSlot</span></a></span><span> </span><span class="annot"><span class="annottext">Area
</span><a href="GHC.Cmm.Expr.html#Old"><span class="hs-identifier hs-var">Old</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053280"><span class="hs-identifier hs-var">updfr_off</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; CmmType
</span><a href="GHC.Cmm.Type.html#gcWord"><span class="hs-identifier hs-var">gcWord</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053284"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-89"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; CmmExpr -&gt; [CmmExpr] -&gt; Int -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkReturn"><span class="hs-identifier hs-var">mkReturn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053286"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; CmmExpr -&gt; CmmExpr
</span><a href="GHC.Cmm.Info.html#entryCode"><span class="hs-identifier hs-var">entryCode</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053284"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053277"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053287"><span class="hs-identifier hs-var">results</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053280"><span class="hs-identifier hs-var">updfr_off</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-90"></span><span>                </span><span class="hs-special">}</span><span>
</span><span id="line-91"></span><span>           </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#AssignTo"><span class="hs-identifier hs-type">AssignTo</span></a></span><span> </span><span id="local-6989586621681053268"><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681053268"><span class="hs-identifier hs-var">regs</span></a></span></span><span> </span><span id="local-6989586621681053267"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053267"><span class="hs-identifier hs-var">adjust</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-92"></span><span>             </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; FCode () -&gt; FCode ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681053267"><span class="hs-identifier hs-var">adjust</span></a></span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="GHC.StgToCmm.Layout.html#adjustHpBackwards"><span class="hs-identifier hs-var">adjustHpBackwards</span></a></span><span>
</span><span id="line-93"></span><span>                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[LocalReg] -&gt; [CmmExpr] -&gt; FCode ()
</span><a href="GHC.StgToCmm.Utils.html#emitMultiAssign"><span class="hs-identifier hs-var">emitMultiAssign</span></a></span><span>  </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681053268"><span class="hs-identifier hs-var">regs</span></a></span><span> </span><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053287"><span class="hs-identifier hs-var">results</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-94"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ReturnKind -&gt; FCode ReturnKind
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ReturnKind
</span><a href="GHC.StgToCmm.Monad.html#AssignedDirectly"><span class="hs-identifier hs-var">AssignedDirectly</span></a></span><span>
</span><span id="line-95"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-96"></span><span>
</span><span id="line-97"></span><span>
</span><span id="line-98"></span><span class="hs-comment">-- | @emitCall conv fun args@ makes a call to the entry-code of @fun@,</span><span>
</span><span id="line-99"></span><span class="hs-comment">-- using the call/return convention @conv@, passing @args@, and</span><span>
</span><span id="line-100"></span><span class="hs-comment">-- returning the results to the current sequel.</span><span>
</span><span id="line-101"></span><span class="hs-comment">--</span><span>
</span><span id="line-102"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#emitCall"><span class="hs-identifier hs-type">emitCall</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Node.html#Convention"><span class="hs-identifier hs-type">Convention</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Cmm.Node.html#Convention"><span class="hs-identifier hs-type">Convention</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#ReturnKind"><span class="hs-identifier hs-type">ReturnKind</span></a></span><span>
</span><span id="line-103"></span><span id="emitCall"><span class="annot"><span class="annottext">emitCall :: (Convention, Convention)
-&gt; CmmExpr -&gt; [CmmExpr] -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#emitCall"><span class="hs-identifier hs-var hs-var">emitCall</span></a></span></span><span> </span><span id="local-6989586621681053263"><span class="annot"><span class="annottext">(Convention, Convention)
</span><a href="#local-6989586621681053263"><span class="hs-identifier hs-var">convs</span></a></span></span><span> </span><span id="local-6989586621681053262"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053262"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621681053261"><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053261"><span class="hs-identifier hs-var">args</span></a></span></span><span>
</span><span id="line-104"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Convention, Convention)
-&gt; CmmExpr -&gt; [CmmExpr] -&gt; [CmmExpr] -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#emitCallWithExtraStack"><span class="hs-identifier hs-var">emitCallWithExtraStack</span></a></span><span> </span><span class="annot"><span class="annottext">(Convention, Convention)
</span><a href="#local-6989586621681053263"><span class="hs-identifier hs-var">convs</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053262"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053261"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="GHC.Cmm.Graph.html#noExtraStack"><span class="hs-identifier hs-var">noExtraStack</span></a></span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span class="hs-comment">-- | @emitCallWithExtraStack conv fun args stack@ makes a call to the</span><span>
</span><span id="line-108"></span><span class="hs-comment">-- entry-code of @fun@, using the call/return convention @conv@,</span><span>
</span><span id="line-109"></span><span class="hs-comment">-- passing @args@, pushing some extra stack frames described by</span><span>
</span><span id="line-110"></span><span class="hs-comment">-- @stack@, and returning the results to the current sequel.</span><span>
</span><span id="line-111"></span><span class="hs-comment">--</span><span>
</span><span id="line-112"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#emitCallWithExtraStack"><span class="hs-identifier hs-type">emitCallWithExtraStack</span></a></span><span>
</span><span id="line-113"></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Node.html#Convention"><span class="hs-identifier hs-type">Convention</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Cmm.Node.html#Convention"><span class="hs-identifier hs-type">Convention</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-114"></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#ReturnKind"><span class="hs-identifier hs-type">ReturnKind</span></a></span><span>
</span><span id="line-115"></span><span id="emitCallWithExtraStack"><span class="annot"><span class="annottext">emitCallWithExtraStack :: (Convention, Convention)
-&gt; CmmExpr -&gt; [CmmExpr] -&gt; [CmmExpr] -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#emitCallWithExtraStack"><span class="hs-identifier hs-var hs-var">emitCallWithExtraStack</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681053258"><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053258"><span class="hs-identifier hs-var">callConv</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053257"><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053257"><span class="hs-identifier hs-var">retConv</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681053256"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053256"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621681053255"><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053255"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621681053254"><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053254"><span class="hs-identifier hs-var">extra_stack</span></a></span></span><span>
</span><span id="line-116"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681053253"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053253"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-117"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="GHC.StgToCmm.Layout.html#adjustHpBackwards"><span class="hs-identifier hs-var">adjustHpBackwards</span></a></span><span>
</span><span id="line-118"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681053252"><span class="annot"><span class="annottext">Sequel
</span><a href="#local-6989586621681053252"><span class="hs-identifier hs-var">sequel</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Sequel
</span><a href="GHC.StgToCmm.Monad.html#getSequel"><span class="hs-identifier hs-var">getSequel</span></a></span><span>
</span><span id="line-119"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681053251"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053251"><span class="hs-identifier hs-var">updfr_off</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Int
</span><a href="GHC.StgToCmm.Monad.html#getUpdFrameOff"><span class="hs-identifier hs-var">getUpdFrameOff</span></a></span><span>
</span><span id="line-120"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Sequel
</span><a href="#local-6989586621681053252"><span class="hs-identifier hs-var">sequel</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-121"></span><span>            </span><span class="annot"><span class="annottext">Sequel
</span><a href="GHC.StgToCmm.Monad.html#Return"><span class="hs-identifier hs-var">Return</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-122"></span><span>              </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmAGraph -&gt; FCode ()) -&gt; CmmAGraph -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Convention
-&gt; CmmExpr
-&gt; [CmmExpr]
-&gt; Int
-&gt; [CmmExpr]
-&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkJumpExtra"><span class="hs-identifier hs-var">mkJumpExtra</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053253"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053258"><span class="hs-identifier hs-var">callConv</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053256"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053255"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053251"><span class="hs-identifier hs-var">updfr_off</span></a></span><span> </span><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053254"><span class="hs-identifier hs-var">extra_stack</span></a></span><span>
</span><span id="line-123"></span><span>              </span><span class="annot"><span class="annottext">ReturnKind -&gt; FCode ReturnKind
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ReturnKind
</span><a href="GHC.StgToCmm.Monad.html#AssignedDirectly"><span class="hs-identifier hs-var">AssignedDirectly</span></a></span><span>
</span><span id="line-124"></span><span>            </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#AssignTo"><span class="hs-identifier hs-type">AssignTo</span></a></span><span> </span><span id="local-6989586621681053249"><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681053249"><span class="hs-identifier hs-var">res_regs</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-125"></span><span>              </span><span id="local-6989586621681053248"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053248"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode BlockId
forall (m :: * -&gt; *). MonadUnique m =&gt; m BlockId
</span><a href="GHC.Cmm.BlockId.html#newBlockId"><span class="hs-identifier hs-var">newBlockId</span></a></span><span>
</span><span id="line-126"></span><span>              </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681053246"><span class="annot"><span class="annottext">area :: Area
</span><a href="#local-6989586621681053246"><span class="hs-identifier hs-var hs-var">area</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; Area
</span><a href="GHC.Cmm.Expr.html#Young"><span class="hs-identifier hs-var">Young</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053248"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-127"></span><span>                  </span><span class="hs-special">(</span><span id="local-6989586621681053244"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053244"><span class="hs-identifier hs-var">off</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[GlobalReg]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053243"><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681053243"><span class="hs-identifier hs-var">copyin</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Convention
-&gt; Area
-&gt; [LocalReg]
-&gt; [LocalReg]
-&gt; (Int, [GlobalReg], CmmAGraph)
</span><a href="GHC.Cmm.Graph.html#copyInOflow"><span class="hs-identifier hs-var">copyInOflow</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053253"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053257"><span class="hs-identifier hs-var">retConv</span></a></span><span> </span><span class="annot"><span class="annottext">Area
</span><a href="#local-6989586621681053246"><span class="hs-identifier hs-var">area</span></a></span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681053249"><span class="hs-identifier hs-var">res_regs</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-128"></span><span>                  </span><span id="local-6989586621681053241"><span class="annot"><span class="annottext">copyout :: CmmAGraph
</span><a href="#local-6989586621681053241"><span class="hs-identifier hs-var hs-var">copyout</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; CmmExpr
-&gt; Convention
-&gt; [CmmExpr]
-&gt; BlockId
-&gt; Int
-&gt; Int
-&gt; [CmmExpr]
-&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkCallReturnsTo"><span class="hs-identifier hs-var">mkCallReturnsTo</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053253"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053256"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053258"><span class="hs-identifier hs-var">callConv</span></a></span><span> </span><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053255"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053248"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053244"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053251"><span class="hs-identifier hs-var">updfr_off</span></a></span><span>
</span><span id="line-129"></span><span>                                   </span><span class="annot"><span class="annottext">[CmmExpr]
</span><a href="#local-6989586621681053254"><span class="hs-identifier hs-var">extra_stack</span></a></span><span>
</span><span id="line-130"></span><span>              </span><span id="local-6989586621681053239"><span class="annot"><span class="annottext">CmmTickScope
</span><a href="#local-6989586621681053239"><span class="hs-identifier hs-var">tscope</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode CmmTickScope
</span><a href="GHC.StgToCmm.Monad.html#getTickScope"><span class="hs-identifier hs-var">getTickScope</span></a></span><span>
</span><span id="line-131"></span><span>              </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681053241"><span class="hs-identifier hs-var">copyout</span></a></span><span> </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; CmmTickScope -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkLabel"><span class="hs-identifier hs-var">mkLabel</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053248"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">CmmTickScope
</span><a href="#local-6989586621681053239"><span class="hs-identifier hs-var">tscope</span></a></span><span> </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681053243"><span class="hs-identifier hs-var">copyin</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-132"></span><span>              </span><span class="annot"><span class="annottext">ReturnKind -&gt; FCode ReturnKind
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BlockId -&gt; Int -&gt; ReturnKind
</span><a href="GHC.StgToCmm.Monad.html#ReturnedTo"><span class="hs-identifier hs-var">ReturnedTo</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053248"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053244"><span class="hs-identifier hs-var">off</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-133"></span><span>      </span><span class="hs-special">}</span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span>
</span><span id="line-136"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#adjustHpBackwards"><span class="hs-identifier hs-type">adjustHpBackwards</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-137"></span><span class="hs-comment">-- This function adjusts the heap pointer just before a tail call or</span><span>
</span><span id="line-138"></span><span class="hs-comment">-- return.  At a call or return, the virtual heap pointer may be less</span><span>
</span><span id="line-139"></span><span class="hs-comment">-- than the real Hp, because the latter was advanced to deal with</span><span>
</span><span id="line-140"></span><span class="hs-comment">-- the worst-case branch of the code, and we may be in a better-case</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- branch.  In that case, move the real Hp *back* and retract some</span><span>
</span><span id="line-142"></span><span class="hs-comment">-- ticky allocation count.</span><span>
</span><span id="line-143"></span><span class="hs-comment">--</span><span>
</span><span id="line-144"></span><span class="hs-comment">-- It *does not* deal with high-water-mark adjustment.  That's done by</span><span>
</span><span id="line-145"></span><span class="hs-comment">-- functions which allocate heap.</span><span>
</span><span id="line-146"></span><span id="adjustHpBackwards"><span class="annot"><span class="annottext">adjustHpBackwards :: FCode ()
</span><a href="GHC.StgToCmm.Layout.html#adjustHpBackwards"><span class="hs-identifier hs-var hs-var">adjustHpBackwards</span></a></span></span><span>
</span><span id="line-147"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681053234"><span class="annot"><span class="annottext">HeapUsage
</span><a href="#local-6989586621681053234"><span class="hs-identifier hs-var">hp_usg</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode HeapUsage
</span><a href="GHC.StgToCmm.Monad.html#getHpUsage"><span class="hs-identifier hs-var">getHpUsage</span></a></span><span>
</span><span id="line-148"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681053232"><span class="annot"><span class="annottext">rHp :: Int
</span><a href="#local-6989586621681053232"><span class="hs-identifier hs-var hs-var">rHp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HeapUsage -&gt; Int
</span><a href="GHC.StgToCmm.Monad.html#realHp"><span class="hs-identifier hs-var hs-var">realHp</span></a></span><span> </span><span class="annot"><span class="annottext">HeapUsage
</span><a href="#local-6989586621681053234"><span class="hs-identifier hs-var">hp_usg</span></a></span><span>
</span><span id="line-149"></span><span>              </span><span id="local-6989586621681053230"><span class="annot"><span class="annottext">vHp :: Int
</span><a href="#local-6989586621681053230"><span class="hs-identifier hs-var hs-var">vHp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HeapUsage -&gt; Int
</span><a href="GHC.StgToCmm.Monad.html#virtHp"><span class="hs-identifier hs-var hs-var">virtHp</span></a></span><span> </span><span class="annot"><span class="annottext">HeapUsage
</span><a href="#local-6989586621681053234"><span class="hs-identifier hs-var">hp_usg</span></a></span><span>
</span><span id="line-150"></span><span>              </span><span id="local-6989586621681053227"><span class="annot"><span class="annottext">adjust_words :: Int
</span><a href="#local-6989586621681053227"><span class="hs-identifier hs-var hs-var">adjust_words</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053230"><span class="hs-identifier hs-var">vHp</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053232"><span class="hs-identifier hs-var">rHp</span></a></span><span>
</span><span id="line-151"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681053226"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053226"><span class="hs-identifier hs-var">new_hp</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; FCode CmmExpr
</span><a href="GHC.StgToCmm.Layout.html#getHpRelOffset"><span class="hs-identifier hs-var">getHpRelOffset</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053230"><span class="hs-identifier hs-var">vHp</span></a></span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053227"><span class="hs-identifier hs-var">adjust_words</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-154"></span><span>                </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkNop"><span class="hs-identifier hs-var">mkNop</span></a></span><span>
</span><span id="line-155"></span><span>                </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkAssign"><span class="hs-identifier hs-var">mkAssign</span></a></span><span> </span><span class="annot"><span class="annottext">CmmReg
</span><a href="GHC.Cmm.Expr.html#hpReg"><span class="hs-identifier hs-var">hpReg</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053226"><span class="hs-identifier hs-var">new_hp</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Generates nothing when vHp==rHp</span><span>
</span><span id="line-156"></span><span>
</span><span id="line-157"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Int -&gt; FCode ()
</span><a href="GHC.StgToCmm.Ticky.html#tickyAllocHeap"><span class="hs-identifier hs-var">tickyAllocHeap</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053227"><span class="hs-identifier hs-var">adjust_words</span></a></span><span> </span><span class="hs-comment">-- ...ditto</span><span>
</span><span id="line-158"></span><span>
</span><span id="line-159"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#setRealHp"><span class="hs-identifier hs-var">setRealHp</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053230"><span class="hs-identifier hs-var">vHp</span></a></span><span>
</span><span id="line-160"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span class="hs-comment">-------------------------------------------------------------------------</span><span>
</span><span id="line-164"></span><span class="hs-comment">--        Making calls: directCall and slowCall</span><span>
</span><span id="line-165"></span><span class="hs-comment">-------------------------------------------------------------------------</span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span class="hs-comment">-- General plan is:</span><span>
</span><span id="line-168"></span><span class="hs-comment">--   - we'll make *one* fast call, either to the function itself</span><span>
</span><span id="line-169"></span><span class="hs-comment">--     (directCall) or to stg_ap_&lt;pat&gt;_fast (slowCall)</span><span>
</span><span id="line-170"></span><span class="hs-comment">--     Any left-over arguments will be pushed on the stack,</span><span>
</span><span id="line-171"></span><span class="hs-comment">--</span><span>
</span><span id="line-172"></span><span class="hs-comment">--     e.g. Sp[old+8]  = arg1</span><span>
</span><span id="line-173"></span><span class="hs-comment">--          Sp[old+16] = arg2</span><span>
</span><span id="line-174"></span><span class="hs-comment">--          Sp[old+32] = stg_ap_pp_info</span><span>
</span><span id="line-175"></span><span class="hs-comment">--          R2 = arg3</span><span>
</span><span id="line-176"></span><span class="hs-comment">--          R3 = arg4</span><span>
</span><span id="line-177"></span><span class="hs-comment">--          call f() return to Nothing updfr_off: 32</span><span>
</span><span id="line-178"></span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#directCall"><span class="hs-identifier hs-type">directCall</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Node.html#Convention"><span class="hs-identifier hs-type">Convention</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.CLabel.html#CLabel"><span class="hs-identifier hs-type">CLabel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RepArity"><span class="hs-identifier hs-type">RepArity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgArg"><span class="hs-identifier hs-type">StgArg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#ReturnKind"><span class="hs-identifier hs-type">ReturnKind</span></a></span><span>
</span><span id="line-181"></span><span class="hs-comment">-- (directCall f n args)</span><span>
</span><span id="line-182"></span><span class="hs-comment">-- calls f(arg1, ..., argn), and applies the result to the remaining args</span><span>
</span><span id="line-183"></span><span class="hs-comment">-- The function f has arity n, and there are guaranteed at least n args</span><span>
</span><span id="line-184"></span><span class="hs-comment">-- Both arity and args include void args</span><span>
</span><span id="line-185"></span><span id="directCall"><span class="annot"><span class="annottext">directCall :: Convention -&gt; CLabel -&gt; Int -&gt; [StgArg] -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#directCall"><span class="hs-identifier hs-var hs-var">directCall</span></a></span></span><span> </span><span id="local-6989586621681053220"><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053220"><span class="hs-identifier hs-var">conv</span></a></span></span><span> </span><span id="local-6989586621681053219"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681053219"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681053218"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053218"><span class="hs-identifier hs-var">arity</span></a></span></span><span> </span><span id="local-6989586621681053217"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053217"><span class="hs-identifier hs-var">stg_args</span></a></span></span><span>
</span><span id="line-186"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681053216"><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053216"><span class="hs-identifier hs-var">argreps</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[StgArg] -&gt; FCode [(ArgRep, Maybe CmmExpr)]
</span><a href="GHC.StgToCmm.Layout.html#getArgRepsAmodes"><span class="hs-identifier hs-var">getArgRepsAmodes</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053217"><span class="hs-identifier hs-var">stg_args</span></a></span><span>
</span><span id="line-187"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String
-&gt; Convention
-&gt; CLabel
-&gt; Int
-&gt; [(ArgRep, Maybe CmmExpr)]
-&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#direct_call"><span class="hs-identifier hs-var">direct_call</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;directCall&quot;</span></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053220"><span class="hs-identifier hs-var">conv</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681053219"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053218"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053216"><span class="hs-identifier hs-var">argreps</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span>
</span><span id="line-190"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#slowCall"><span class="hs-identifier hs-type">slowCall</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgArg"><span class="hs-identifier hs-type">StgArg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#ReturnKind"><span class="hs-identifier hs-type">ReturnKind</span></a></span><span>
</span><span id="line-191"></span><span class="hs-comment">-- (slowCall fun args) applies fun to args, returning the results to Sequel</span><span>
</span><span id="line-192"></span><span id="slowCall"><span class="annot"><span class="annottext">slowCall :: CmmExpr -&gt; [StgArg] -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#slowCall"><span class="hs-identifier hs-var hs-var">slowCall</span></a></span></span><span> </span><span id="local-6989586621681053213"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053213"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621681053212"><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053212"><span class="hs-identifier hs-var">stg_args</span></a></span></span><span>
</span><span id="line-193"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span id="local-6989586621681053211"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053211"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-194"></span><span>        </span><span id="local-6989586621681053210"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053210"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Platform
</span><a href="GHC.StgToCmm.Monad.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-195"></span><span>        </span><span id="local-6989586621681053209"><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053209"><span class="hs-identifier hs-var">argsreps</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[StgArg] -&gt; FCode [(ArgRep, Maybe CmmExpr)]
</span><a href="GHC.StgToCmm.Layout.html#getArgRepsAmodes"><span class="hs-identifier hs-var">getArgRepsAmodes</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053212"><span class="hs-identifier hs-var">stg_args</span></a></span><span>
</span><span id="line-196"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681053208"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681053208"><span class="hs-identifier hs-var">rts_fun</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053207"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053207"><span class="hs-identifier hs-var">arity</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgRep] -&gt; (FastString, Int)
</span><a href="GHC.StgToCmm.ArgRep.html#slowCallPattern"><span class="hs-identifier hs-var">slowCallPattern</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((ArgRep, Maybe CmmExpr) -&gt; ArgRep)
-&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [ArgRep]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgRep, Maybe CmmExpr) -&gt; ArgRep
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053209"><span class="hs-identifier hs-var">argsreps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-197"></span><span>
</span><span id="line-198"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681053205"><span class="annot"><span class="annottext">ReturnKind
</span><a href="#local-6989586621681053205"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053204"><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681053204"><span class="hs-identifier hs-var">slow_code</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode ReturnKind -&gt; FCode (ReturnKind, CmmAGraph)
forall a. FCode a -&gt; FCode (a, CmmAGraph)
</span><a href="GHC.StgToCmm.Monad.html#getCodeR"><span class="hs-identifier hs-var">getCodeR</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode ReturnKind -&gt; FCode (ReturnKind, CmmAGraph))
-&gt; FCode ReturnKind -&gt; FCode (ReturnKind, CmmAGraph)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-199"></span><span>           </span><span id="local-6989586621681053202"><span class="annot"><span class="annottext">ReturnKind
</span><a href="#local-6989586621681053202"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String
-&gt; Convention
-&gt; CLabel
-&gt; Int
-&gt; [(ArgRep, Maybe CmmExpr)]
-&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#direct_call"><span class="hs-identifier hs-var">direct_call</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;slow_call&quot;</span></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeNodeCall"><span class="hs-identifier hs-var">NativeNodeCall</span></a></span><span>
</span><span id="line-200"></span><span>                 </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; CLabel
</span><a href="GHC.Cmm.CLabel.html#mkRtsApFastLabel"><span class="hs-identifier hs-var">mkRtsApFastLabel</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681053208"><span class="hs-identifier hs-var">rts_fun</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053207"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">CmmExpr -&gt; Maybe CmmExpr
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053213"><span class="hs-identifier hs-var">fun</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">(ArgRep, Maybe CmmExpr)
-&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [(ArgRep, Maybe CmmExpr)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053209"><span class="hs-identifier hs-var">argsreps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-201"></span><span>           </span><span class="annot"><span class="annottext">FastString -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emitComment"><span class="hs-identifier hs-var">emitComment</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; FCode ()) -&gt; FastString -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;slow_call for &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span>
</span><span id="line-202"></span><span>                                      </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053211"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmExpr -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053213"><span class="hs-identifier hs-var">fun</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span>
</span><span id="line-203"></span><span>                                      </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; with pat &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; String
</span><a href="GHC.Data.FastString.html#unpackFS"><span class="hs-identifier hs-var">unpackFS</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681053208"><span class="hs-identifier hs-var">rts_fun</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-204"></span><span>           </span><span class="annot"><span class="annottext">ReturnKind -&gt; FCode ReturnKind
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ReturnKind
</span><a href="#local-6989586621681053202"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-205"></span><span>
</span><span id="line-206"></span><span>        </span><span class="hs-comment">-- Note [avoid intermediate PAPs]</span><span>
</span><span id="line-207"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681053192"><span class="annot"><span class="annottext">n_args :: Int
</span><a href="#local-6989586621681053192"><span class="hs-identifier hs-var hs-var">n_args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[StgArg] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><a href="#local-6989586621681053212"><span class="hs-identifier hs-var">stg_args</span></a></span><span>
</span><span id="line-208"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053192"><span class="hs-identifier hs-var">n_args</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053207"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Int
</span><a href="GHC.Driver.Session.html#optLevel"><span class="hs-identifier hs-var hs-var">optLevel</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053211"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span>
</span><span id="line-209"></span><span>           </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-210"></span><span>             </span><span id="local-6989586621681053187"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053187"><span class="hs-identifier hs-var">funv</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmReg -&gt; CmmExpr) -&gt; (LocalReg -&gt; CmmReg) -&gt; LocalReg -&gt; CmmExpr
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(LocalReg -&gt; CmmExpr) -&gt; FCode LocalReg -&gt; FCode CmmExpr
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-operator hs-var">`fmap`</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; FCode LocalReg
</span><a href="GHC.StgToCmm.Utils.html#assignTemp"><span class="hs-identifier hs-var">assignTemp</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053213"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-211"></span><span>             </span><span id="local-6989586621681053182"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053182"><span class="hs-identifier hs-var">fun_iptr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmReg -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmReg"><span class="hs-identifier hs-var">CmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmReg -&gt; CmmExpr) -&gt; (LocalReg -&gt; CmmReg) -&gt; LocalReg -&gt; CmmExpr
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmLocal"><span class="hs-identifier hs-var">CmmLocal</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(LocalReg -&gt; CmmExpr) -&gt; FCode LocalReg -&gt; FCode CmmExpr
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-operator hs-var">`fmap`</span></a></span><span>
</span><span id="line-212"></span><span>                    </span><span class="annot"><span class="annottext">CmmExpr -&gt; FCode LocalReg
</span><a href="GHC.StgToCmm.Utils.html#assignTemp"><span class="hs-identifier hs-var">assignTemp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; CmmExpr -&gt; CmmExpr
</span><a href="GHC.Cmm.Info.html#closureInfoPtr"><span class="hs-identifier hs-var">closureInfoPtr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053211"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; CmmExpr -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#cmmUntag"><span class="hs-identifier hs-var">cmmUntag</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053211"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053187"><span class="hs-identifier hs-var">funv</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span>             </span><span class="hs-comment">-- ToDo: we could do slightly better here by reusing the</span><span>
</span><span id="line-215"></span><span>             </span><span class="hs-comment">-- continuation from the slow call, which we have in r.</span><span>
</span><span id="line-216"></span><span>             </span><span class="hs-comment">-- Also we'd like to push the continuation on the stack</span><span>
</span><span id="line-217"></span><span>             </span><span class="hs-comment">-- before the branch, so that we only get one copy of the</span><span>
</span><span id="line-218"></span><span>             </span><span class="hs-comment">-- code that saves all the live variables across the</span><span>
</span><span id="line-219"></span><span>             </span><span class="hs-comment">-- call, but that might need some improvements to the</span><span>
</span><span id="line-220"></span><span>             </span><span class="hs-comment">-- special case in the stack layout code to handle this</span><span>
</span><span id="line-221"></span><span>             </span><span class="hs-comment">-- (see Note [diamond proc point]).</span><span>
</span><span id="line-222"></span><span>
</span><span id="line-223"></span><span>             </span><span id="local-6989586621681053179"><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681053179"><span class="hs-identifier hs-var">fast_code</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode ReturnKind -&gt; FCode CmmAGraph
forall a. FCode a -&gt; FCode CmmAGraph
</span><a href="GHC.StgToCmm.Monad.html#getCode"><span class="hs-identifier hs-var">getCode</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode ReturnKind -&gt; FCode CmmAGraph)
-&gt; FCode ReturnKind -&gt; FCode CmmAGraph
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-224"></span><span>                </span><span class="annot"><span class="annottext">(Convention, Convention)
-&gt; CmmExpr -&gt; [CmmExpr] -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#emitCall"><span class="hs-identifier hs-var">emitCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeNodeCall"><span class="hs-identifier hs-var">NativeNodeCall</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeReturn"><span class="hs-identifier hs-var">NativeReturn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-225"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; CmmExpr -&gt; CmmExpr
</span><a href="GHC.Cmm.Info.html#entryCode"><span class="hs-identifier hs-var">entryCode</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053210"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053182"><span class="hs-identifier hs-var">fun_iptr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)] -&gt; [CmmExpr]
</span><a href="GHC.StgToCmm.Layout.html#nonVArgs"><span class="hs-identifier hs-var">nonVArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">CmmExpr -&gt; Maybe CmmExpr
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053187"><span class="hs-identifier hs-var">funv</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">(ArgRep, Maybe CmmExpr)
-&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [(ArgRep, Maybe CmmExpr)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053209"><span class="hs-identifier hs-var">argsreps</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span>             </span><span id="local-6989586621681053175"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053175"><span class="hs-identifier hs-var">slow_lbl</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode BlockId
forall (m :: * -&gt; *). MonadUnique m =&gt; m BlockId
</span><a href="GHC.Cmm.BlockId.html#newBlockId"><span class="hs-identifier hs-var">newBlockId</span></a></span><span>
</span><span id="line-229"></span><span>             </span><span id="local-6989586621681053174"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053174"><span class="hs-identifier hs-var">fast_lbl</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode BlockId
forall (m :: * -&gt; *). MonadUnique m =&gt; m BlockId
</span><a href="GHC.Cmm.BlockId.html#newBlockId"><span class="hs-identifier hs-var">newBlockId</span></a></span><span>
</span><span id="line-230"></span><span>             </span><span id="local-6989586621681053173"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053173"><span class="hs-identifier hs-var">is_tagged_lbl</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode BlockId
forall (m :: * -&gt; *). MonadUnique m =&gt; m BlockId
</span><a href="GHC.Cmm.BlockId.html#newBlockId"><span class="hs-identifier hs-var">newBlockId</span></a></span><span>
</span><span id="line-231"></span><span>             </span><span id="local-6989586621681053172"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053172"><span class="hs-identifier hs-var">end_lbl</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode BlockId
forall (m :: * -&gt; *). MonadUnique m =&gt; m BlockId
</span><a href="GHC.Cmm.BlockId.html#newBlockId"><span class="hs-identifier hs-var">newBlockId</span></a></span><span>
</span><span id="line-232"></span><span>
</span><span id="line-233"></span><span>             </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681053171"><span class="annot"><span class="annottext">correct_arity :: CmmExpr
</span><a href="#local-6989586621681053171"><span class="hs-identifier hs-var hs-var">correct_arity</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; CmmExpr -&gt; CmmExpr -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#cmmEqWord"><span class="hs-identifier hs-var">cmmEqWord</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053210"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; CmmExpr -&gt; CmmExpr
</span><a href="GHC.Cmm.Info.html#funInfoArity"><span class="hs-identifier hs-var">funInfoArity</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053211"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053182"><span class="hs-identifier hs-var">fun_iptr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-234"></span><span>                                                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; Int -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#mkIntExpr"><span class="hs-identifier hs-var">mkIntExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053210"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053192"><span class="hs-identifier hs-var">n_args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span>             </span><span id="local-6989586621681053167"><span class="annot"><span class="annottext">CmmTickScope
</span><a href="#local-6989586621681053167"><span class="hs-identifier hs-var">tscope</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode CmmTickScope
</span><a href="GHC.StgToCmm.Monad.html#getTickScope"><span class="hs-identifier hs-var">getTickScope</span></a></span><span>
</span><span id="line-237"></span><span>             </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmExpr -&gt; BlockId -&gt; BlockId -&gt; Maybe Bool -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkCbranch"><span class="hs-identifier hs-var">mkCbranch</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; CmmExpr -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#cmmIsTagged"><span class="hs-identifier hs-var">cmmIsTagged</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053211"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053187"><span class="hs-identifier hs-var">funv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-238"></span><span>                             </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053173"><span class="hs-identifier hs-var">is_tagged_lbl</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053175"><span class="hs-identifier hs-var">slow_lbl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Maybe Bool
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>
</span><span id="line-239"></span><span>                   </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; CmmTickScope -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkLabel"><span class="hs-identifier hs-var">mkLabel</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053173"><span class="hs-identifier hs-var">is_tagged_lbl</span></a></span><span> </span><span class="annot"><span class="annottext">CmmTickScope
</span><a href="#local-6989586621681053167"><span class="hs-identifier hs-var">tscope</span></a></span><span>
</span><span id="line-240"></span><span>                   </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; BlockId -&gt; BlockId -&gt; Maybe Bool -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkCbranch"><span class="hs-identifier hs-var">mkCbranch</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053171"><span class="hs-identifier hs-var">correct_arity</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053174"><span class="hs-identifier hs-var">fast_lbl</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053175"><span class="hs-identifier hs-var">slow_lbl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Maybe Bool
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>
</span><span id="line-241"></span><span>                   </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; CmmTickScope -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkLabel"><span class="hs-identifier hs-var">mkLabel</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053174"><span class="hs-identifier hs-var">fast_lbl</span></a></span><span> </span><span class="annot"><span class="annottext">CmmTickScope
</span><a href="#local-6989586621681053167"><span class="hs-identifier hs-var">tscope</span></a></span><span>
</span><span id="line-242"></span><span>                   </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681053179"><span class="hs-identifier hs-var">fast_code</span></a></span><span>
</span><span id="line-243"></span><span>                   </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkBranch"><span class="hs-identifier hs-var">mkBranch</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053172"><span class="hs-identifier hs-var">end_lbl</span></a></span><span>
</span><span id="line-244"></span><span>                   </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; CmmTickScope -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkLabel"><span class="hs-identifier hs-var">mkLabel</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053175"><span class="hs-identifier hs-var">slow_lbl</span></a></span><span> </span><span class="annot"><span class="annottext">CmmTickScope
</span><a href="#local-6989586621681053167"><span class="hs-identifier hs-var">tscope</span></a></span><span>
</span><span id="line-245"></span><span>                   </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681053204"><span class="hs-identifier hs-var">slow_code</span></a></span><span>
</span><span id="line-246"></span><span>                   </span><span class="annot"><span class="annottext">CmmAGraph -&gt; CmmAGraph -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; CmmTickScope -&gt; CmmAGraph
</span><a href="GHC.Cmm.Graph.html#mkLabel"><span class="hs-identifier hs-var">mkLabel</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681053172"><span class="hs-identifier hs-var">end_lbl</span></a></span><span> </span><span class="annot"><span class="annottext">CmmTickScope
</span><a href="#local-6989586621681053167"><span class="hs-identifier hs-var">tscope</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-247"></span><span>             </span><span class="annot"><span class="annottext">ReturnKind -&gt; FCode ReturnKind
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ReturnKind
</span><a href="#local-6989586621681053205"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-248"></span><span>
</span><span id="line-249"></span><span>           </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-250"></span><span>             </span><span class="annot"><span class="annottext">CmmAGraph -&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emit"><span class="hs-identifier hs-var">emit</span></a></span><span> </span><span class="annot"><span class="annottext">CmmAGraph
</span><a href="#local-6989586621681053204"><span class="hs-identifier hs-var">slow_code</span></a></span><span>
</span><span id="line-251"></span><span>             </span><span class="annot"><span class="annottext">ReturnKind -&gt; FCode ReturnKind
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ReturnKind
</span><a href="#local-6989586621681053205"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span>
</span><span id="line-254"></span><span class="hs-comment">-- Note [avoid intermediate PAPs]</span><span>
</span><span id="line-255"></span><span class="hs-comment">--</span><span>
</span><span id="line-256"></span><span class="hs-comment">-- A slow call which needs multiple generic apply patterns will be</span><span>
</span><span id="line-257"></span><span class="hs-comment">-- almost guaranteed to create one or more intermediate PAPs when</span><span>
</span><span id="line-258"></span><span class="hs-comment">-- applied to a function that takes the correct number of arguments.</span><span>
</span><span id="line-259"></span><span class="hs-comment">-- We try to avoid this situation by generating code to test whether</span><span>
</span><span id="line-260"></span><span class="hs-comment">-- we are calling a function with the correct number of arguments</span><span>
</span><span id="line-261"></span><span class="hs-comment">-- first, i.e.:</span><span>
</span><span id="line-262"></span><span class="hs-comment">--</span><span>
</span><span id="line-263"></span><span class="hs-comment">--   if (TAG(f) != 0} {  // f is not a thunk</span><span>
</span><span id="line-264"></span><span class="hs-comment">--      if (f-&gt;info.arity == n) {</span><span>
</span><span id="line-265"></span><span class="hs-comment">--         ... make a fast call to f ...</span><span>
</span><span id="line-266"></span><span class="hs-comment">--      }</span><span>
</span><span id="line-267"></span><span class="hs-comment">--   }</span><span>
</span><span id="line-268"></span><span class="hs-comment">--   ... otherwise make the slow call ...</span><span>
</span><span id="line-269"></span><span class="hs-comment">--</span><span>
</span><span id="line-270"></span><span class="hs-comment">-- We *only* do this when the call requires multiple generic apply</span><span>
</span><span id="line-271"></span><span class="hs-comment">-- functions, which requires pushing extra stack frames and probably</span><span>
</span><span id="line-272"></span><span class="hs-comment">-- results in intermediate PAPs.  (I say probably, because it might be</span><span>
</span><span id="line-273"></span><span class="hs-comment">-- that we're over-applying a function, but that seems even less</span><span>
</span><span id="line-274"></span><span class="hs-comment">-- likely).</span><span>
</span><span id="line-275"></span><span class="hs-comment">--</span><span>
</span><span id="line-276"></span><span class="hs-comment">-- This very rarely applies, but if it does happen in an inner loop it</span><span>
</span><span id="line-277"></span><span class="hs-comment">-- can have a severe impact on performance (#6084).</span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span>
</span><span id="line-280"></span><span class="hs-comment">--------------</span><span>
</span><span id="line-281"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#direct_call"><span class="hs-identifier hs-type">direct_call</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-282"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Node.html#Convention"><span class="hs-identifier hs-type">Convention</span></a></span><span>     </span><span class="hs-comment">-- e.g. NativeNodeCall or NativeDirectCall</span><span>
</span><span id="line-283"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.CLabel.html#CLabel"><span class="hs-identifier hs-type">CLabel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RepArity"><span class="hs-identifier hs-type">RepArity</span></a></span><span>
</span><span id="line-284"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html#ArgRep"><span class="hs-identifier hs-type">ArgRep</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#ReturnKind"><span class="hs-identifier hs-type">ReturnKind</span></a></span><span>
</span><span id="line-285"></span><span id="direct_call"><span class="annot"><span class="annottext">direct_call :: String
-&gt; Convention
-&gt; CLabel
-&gt; Int
-&gt; [(ArgRep, Maybe CmmExpr)]
-&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#direct_call"><span class="hs-identifier hs-var hs-var">direct_call</span></a></span></span><span> </span><span id="local-6989586621681053163"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681053163"><span class="hs-identifier hs-var">caller</span></a></span></span><span> </span><span id="local-6989586621681053162"><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053162"><span class="hs-identifier hs-var">call_conv</span></a></span></span><span> </span><span id="local-6989586621681053161"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681053161"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681053160"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053160"><span class="hs-identifier hs-var">arity</span></a></span></span><span> </span><span id="local-6989586621681053159"><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053159"><span class="hs-identifier hs-var">args</span></a></span></span><span>
</span><span id="line-286"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Utils.Misc.html#debugIsOn"><span class="hs-identifier hs-var">debugIsOn</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053159"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)] -&gt; Int -&gt; Bool
forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthLessThan"><span class="hs-operator hs-var">`lengthLessThan`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053156"><span class="hs-identifier hs-var">real_arity</span></a></span><span>  </span><span class="hs-comment">-- Too few args</span><span>
</span><span id="line-287"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-comment">-- Caller should ensure that there enough args!</span><span>
</span><span id="line-288"></span><span>       </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; FCode ReturnKind
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;direct_call&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; FCode ReturnKind) -&gt; SDoc -&gt; FCode ReturnKind
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-289"></span><span>            </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681053163"><span class="hs-identifier hs-var">caller</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053160"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-290"></span><span>            </span><span class="annot"><span class="annottext">CLabel -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681053161"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053159"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-291"></span><span>            </span><span class="annot"><span class="annottext">[Maybe CmmExpr] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((ArgRep, Maybe CmmExpr) -&gt; Maybe CmmExpr)
-&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [Maybe CmmExpr]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgRep, Maybe CmmExpr) -&gt; Maybe CmmExpr
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053159"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgRep] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((ArgRep, Maybe CmmExpr) -&gt; ArgRep)
-&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [ArgRep]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgRep, Maybe CmmExpr) -&gt; ArgRep
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053159"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053151"><span class="hs-identifier hs-var">rest_args</span></a></span><span>  </span><span class="hs-comment">-- Precisely the right number of arguments</span><span>
</span><span id="line-294"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Convention, Convention)
-&gt; CmmExpr -&gt; [CmmExpr] -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#emitCall"><span class="hs-identifier hs-var">emitCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053162"><span class="hs-identifier hs-var">call_conv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeReturn"><span class="hs-identifier hs-var">NativeReturn</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053150"><span class="hs-identifier hs-var">target</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)] -&gt; [CmmExpr]
</span><a href="GHC.StgToCmm.Layout.html#nonVArgs"><span class="hs-identifier hs-var">nonVArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053159"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-295"></span><span>
</span><span id="line-296"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>       </span><span class="hs-comment">-- Note [over-saturated calls]</span><span>
</span><span id="line-297"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681053149"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053149"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-298"></span><span>       </span><span class="annot"><span class="annottext">(Convention, Convention)
-&gt; CmmExpr -&gt; [CmmExpr] -&gt; [CmmExpr] -&gt; FCode ReturnKind
</span><a href="GHC.StgToCmm.Layout.html#emitCallWithExtraStack"><span class="hs-identifier hs-var">emitCallWithExtraStack</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053162"><span class="hs-identifier hs-var">call_conv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeReturn"><span class="hs-identifier hs-var">NativeReturn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-299"></span><span>                              </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053150"><span class="hs-identifier hs-var">target</span></a></span><span>
</span><span id="line-300"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)] -&gt; [CmmExpr]
</span><a href="GHC.StgToCmm.Layout.html#nonVArgs"><span class="hs-identifier hs-var">nonVArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053148"><span class="hs-identifier hs-var">fast_args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-301"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)] -&gt; [CmmExpr]
</span><a href="GHC.StgToCmm.Layout.html#nonVArgs"><span class="hs-identifier hs-var">nonVArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; [(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053147"><span class="hs-identifier hs-var">stack_args</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053149"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-302"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-303"></span><span>    </span><span id="local-6989586621681053150"><span class="annot"><span class="annottext">target :: CmmExpr
</span><a href="#local-6989586621681053150"><span class="hs-identifier hs-var hs-var">target</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmLit -&gt; CmmExpr
</span><a href="GHC.Cmm.Expr.html#CmmLit"><span class="hs-identifier hs-var">CmmLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CLabel -&gt; CmmLit
</span><a href="GHC.Cmm.Expr.html#CmmLabel"><span class="hs-identifier hs-var">CmmLabel</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681053161"><span class="hs-identifier hs-var">lbl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-304"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053148"><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053148"><span class="hs-identifier hs-var">fast_args</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053151"><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053151"><span class="hs-identifier hs-var">rest_args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
-&gt; [(ArgRep, Maybe CmmExpr)]
-&gt; ([(ArgRep, Maybe CmmExpr)], [(ArgRep, Maybe CmmExpr)])
forall a. Int -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#splitAt"><span class="hs-identifier hs-var">splitAt</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053156"><span class="hs-identifier hs-var">real_arity</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053159"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-305"></span><span>    </span><span id="local-6989586621681053147"><span class="annot"><span class="annottext">stack_args :: DynFlags -&gt; [(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053147"><span class="hs-identifier hs-var hs-var">stack_args</span></a></span></span><span> </span><span id="local-6989586621681053143"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053143"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [(ArgRep, Maybe CmmExpr)]
</span><a href="GHC.StgToCmm.Layout.html#slowArgs"><span class="hs-identifier hs-var">slowArgs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053143"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053151"><span class="hs-identifier hs-var">rest_args</span></a></span><span>
</span><span id="line-306"></span><span>    </span><span id="local-6989586621681053156"><span class="annot"><span class="annottext">real_arity :: Int
</span><a href="#local-6989586621681053156"><span class="hs-identifier hs-var hs-var">real_arity</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681053162"><span class="hs-identifier hs-var">call_conv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-307"></span><span>                   </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeNodeCall"><span class="hs-identifier hs-var">NativeNodeCall</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053160"><span class="hs-identifier hs-var">arity</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-308"></span><span>                   </span><span class="annot"><span class="annottext">Convention
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053160"><span class="hs-identifier hs-var">arity</span></a></span><span>
</span><span id="line-309"></span><span>
</span><span id="line-310"></span><span>
</span><span id="line-311"></span><span class="hs-comment">-- When constructing calls, it is easier to keep the ArgReps and the</span><span>
</span><span id="line-312"></span><span class="hs-comment">-- CmmExprs zipped together.  However, a void argument has no</span><span>
</span><span id="line-313"></span><span class="hs-comment">-- representation, so we need to use Maybe CmmExpr (the alternative of</span><span>
</span><span id="line-314"></span><span class="hs-comment">-- using zeroCLit or even undefined would work, but would be ugly).</span><span>
</span><span id="line-315"></span><span class="hs-comment">--</span><span>
</span><span id="line-316"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#getArgRepsAmodes"><span class="hs-identifier hs-type">getArgRepsAmodes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgArg"><span class="hs-identifier hs-type">StgArg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html#ArgRep"><span class="hs-identifier hs-type">ArgRep</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-317"></span><span id="getArgRepsAmodes"><span class="annot"><span class="annottext">getArgRepsAmodes :: [StgArg] -&gt; FCode [(ArgRep, Maybe CmmExpr)]
</span><a href="GHC.StgToCmm.Layout.html#getArgRepsAmodes"><span class="hs-identifier hs-var hs-var">getArgRepsAmodes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(StgArg -&gt; FCode (ArgRep, Maybe CmmExpr))
-&gt; [StgArg] -&gt; FCode [(ArgRep, Maybe CmmExpr)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">StgArg -&gt; FCode (ArgRep, Maybe CmmExpr)
</span><a href="#local-6989586621681053137"><span class="hs-identifier hs-var">getArgRepAmode</span></a></span><span>
</span><span id="line-318"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681053137"><span class="annot"><span class="annottext">getArgRepAmode :: StgArg -&gt; FCode (ArgRep, Maybe CmmExpr)
</span><a href="#local-6989586621681053137"><span class="hs-identifier hs-var hs-var">getArgRepAmode</span></a></span></span><span> </span><span id="local-6989586621681053133"><span class="annot"><span class="annottext">StgArg
</span><a href="#local-6989586621681053133"><span class="hs-identifier hs-var">arg</span></a></span></span><span>
</span><span id="line-319"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#V"><span class="hs-identifier hs-var">V</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ArgRep
</span><a href="#local-6989586621681053131"><span class="hs-identifier hs-var">rep</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ArgRep, Maybe CmmExpr) -&gt; FCode (ArgRep, Maybe CmmExpr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#V"><span class="hs-identifier hs-var">V</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe CmmExpr
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-320"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681053130"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053130"><span class="hs-identifier hs-var">expr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">NonVoid StgArg -&gt; FCode CmmExpr
</span><a href="GHC.StgToCmm.Env.html#getArgAmode"><span class="hs-identifier hs-var">getArgAmode</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StgArg -&gt; NonVoid StgArg
forall a. a -&gt; NonVoid a
</span><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-var">NonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">StgArg
</span><a href="#local-6989586621681053133"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-321"></span><span>                            </span><span class="annot"><span class="annottext">(ArgRep, Maybe CmmExpr) -&gt; FCode (ArgRep, Maybe CmmExpr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgRep
</span><a href="#local-6989586621681053131"><span class="hs-identifier hs-var">rep</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; Maybe CmmExpr
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053130"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-322"></span><span>           </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681053131"><span class="annot"><span class="annottext">rep :: ArgRep
</span><a href="#local-6989586621681053131"><span class="hs-identifier hs-var hs-var">rep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PrimRep -&gt; ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#toArgRep"><span class="hs-identifier hs-var">toArgRep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StgArg -&gt; PrimRep
</span><a href="GHC.StgToCmm.Closure.html#argPrimRep"><span class="hs-identifier hs-var">argPrimRep</span></a></span><span> </span><span class="annot"><span class="annottext">StgArg
</span><a href="#local-6989586621681053133"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-323"></span><span>
</span><span id="line-324"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#nonVArgs"><span class="hs-identifier hs-type">nonVArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html#ArgRep"><span class="hs-identifier hs-type">ArgRep</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-325"></span><span id="nonVArgs"><span class="annot"><span class="annottext">nonVArgs :: [(ArgRep, Maybe CmmExpr)] -&gt; [CmmExpr]
</span><a href="GHC.StgToCmm.Layout.html#nonVArgs"><span class="hs-identifier hs-var hs-var">nonVArgs</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-326"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#nonVArgs"><span class="hs-identifier hs-var">nonVArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgRep
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Maybe CmmExpr
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>  </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681053126"><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053126"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)] -&gt; [CmmExpr]
</span><a href="GHC.StgToCmm.Layout.html#nonVArgs"><span class="hs-identifier hs-var">nonVArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053126"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-327"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#nonVArgs"><span class="hs-identifier hs-var">nonVArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgRep
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681053125"><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053125"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681053124"><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053124"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="#local-6989586621681053125"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; [CmmExpr] -&gt; [CmmExpr]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)] -&gt; [CmmExpr]
</span><a href="GHC.StgToCmm.Layout.html#nonVArgs"><span class="hs-identifier hs-var">nonVArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053124"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-328"></span><span>
</span><span id="line-329"></span><span class="hs-comment">{-
Note [over-saturated calls]

The natural thing to do for an over-saturated call would be to call
the function with the correct number of arguments, and then apply the
remaining arguments to the value returned, e.g.

  f a b c d   (where f has arity 2)
  --&gt;
  r = call f(a,b)
  call r(c,d)

but this entails
  - saving c and d on the stack
  - making a continuation info table
  - at the continuation, loading c and d off the stack into regs
  - finally, call r

Note that since there are a fixed number of different r's
(e.g.  stg_ap_pp_fast), we can also pre-compile continuations
that correspond to each of them, rather than generating a fresh
one for each over-saturated call.

Not only does this generate much less code, it is faster too.  We will
generate something like:

Sp[old+16] = c
Sp[old+24] = d
Sp[old+32] = stg_ap_pp_info
call f(a,b) -- usual calling convention

For the purposes of the CmmCall node, we count this extra stack as
just more arguments that we are passing on the stack (cml_args).
-}</span><span>
</span><span id="line-363"></span><span>
</span><span id="line-364"></span><span class="hs-comment">-- | 'slowArgs' takes a list of function arguments and prepares them for</span><span>
</span><span id="line-365"></span><span class="hs-comment">-- pushing on the stack for &quot;extra&quot; arguments to a function which requires</span><span>
</span><span id="line-366"></span><span class="hs-comment">-- fewer arguments than we currently have.</span><span>
</span><span id="line-367"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#slowArgs"><span class="hs-identifier hs-type">slowArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html#ArgRep"><span class="hs-identifier hs-type">ArgRep</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html#ArgRep"><span class="hs-identifier hs-type">ArgRep</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-368"></span><span id="slowArgs"><span class="annot"><span class="annottext">slowArgs :: DynFlags -&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [(ArgRep, Maybe CmmExpr)]
</span><a href="GHC.StgToCmm.Layout.html#slowArgs"><span class="hs-identifier hs-var hs-var">slowArgs</span></a></span></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-369"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#slowArgs"><span class="hs-identifier hs-var">slowArgs</span></a></span><span> </span><span id="local-6989586621681053123"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053123"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681053122"><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053122"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-comment">-- careful: reps contains voids (V), but args does not</span><span>
</span><span id="line-370"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#sccProfilingEnabled"><span class="hs-identifier hs-var">sccProfilingEnabled</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053123"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-371"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053120"><span class="hs-identifier hs-var">save_cccs</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
-&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [(ArgRep, Maybe CmmExpr)]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053119"><span class="hs-identifier hs-var">this_pat</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
-&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [(ArgRep, Maybe CmmExpr)]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [(ArgRep, Maybe CmmExpr)]
</span><a href="GHC.StgToCmm.Layout.html#slowArgs"><span class="hs-identifier hs-var">slowArgs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053123"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053118"><span class="hs-identifier hs-var">rest_args</span></a></span><span>
</span><span id="line-372"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>              </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053119"><span class="hs-identifier hs-var">this_pat</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
-&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [(ArgRep, Maybe CmmExpr)]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [(ArgRep, Maybe CmmExpr)]
</span><a href="GHC.StgToCmm.Layout.html#slowArgs"><span class="hs-identifier hs-var">slowArgs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053123"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053118"><span class="hs-identifier hs-var">rest_args</span></a></span><span>
</span><span id="line-373"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-374"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053117"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681053117"><span class="hs-identifier hs-var">arg_pat</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053116"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053116"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgRep] -&gt; (FastString, Int)
</span><a href="GHC.StgToCmm.ArgRep.html#slowCallPattern"><span class="hs-identifier hs-var">slowCallPattern</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((ArgRep, Maybe CmmExpr) -&gt; ArgRep)
-&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [ArgRep]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgRep, Maybe CmmExpr) -&gt; ArgRep
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053122"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-375"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053115"><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053115"><span class="hs-identifier hs-var">call_args</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053118"><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053118"><span class="hs-identifier hs-var">rest_args</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
-&gt; [(ArgRep, Maybe CmmExpr)]
-&gt; ([(ArgRep, Maybe CmmExpr)], [(ArgRep, Maybe CmmExpr)])
forall a. Int -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#splitAt"><span class="hs-identifier hs-var">splitAt</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053116"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053122"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-376"></span><span>
</span><span id="line-377"></span><span>    </span><span id="local-6989586621681053114"><span class="annot"><span class="annottext">stg_ap_pat :: CLabel
</span><a href="#local-6989586621681053114"><span class="hs-identifier hs-var hs-var">stg_ap_pat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnitId -&gt; FastString -&gt; CLabel
</span><a href="GHC.Cmm.CLabel.html#mkCmmRetInfoLabel"><span class="hs-identifier hs-var">mkCmmRetInfoLabel</span></a></span><span> </span><span class="annot"><span class="annottext">UnitId
</span><a href="GHC.Unit.Types.html#rtsUnitId"><span class="hs-identifier hs-var">rtsUnitId</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681053117"><span class="hs-identifier hs-var">arg_pat</span></a></span><span>
</span><span id="line-378"></span><span>    </span><span id="local-6989586621681053119"><span class="annot"><span class="annottext">this_pat :: [(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053119"><span class="hs-identifier hs-var hs-var">this_pat</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; Maybe CmmExpr
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CLabel -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#mkLblExpr"><span class="hs-identifier hs-var">mkLblExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681053114"><span class="hs-identifier hs-var">stg_ap_pat</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(ArgRep, Maybe CmmExpr)
-&gt; [(ArgRep, Maybe CmmExpr)] -&gt; [(ArgRep, Maybe CmmExpr)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053115"><span class="hs-identifier hs-var">call_args</span></a></span><span>
</span><span id="line-379"></span><span>    </span><span id="local-6989586621681053120"><span class="annot"><span class="annottext">save_cccs :: [(ArgRep, Maybe CmmExpr)]
</span><a href="#local-6989586621681053120"><span class="hs-identifier hs-var hs-var">save_cccs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; Maybe CmmExpr
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CLabel -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#mkLblExpr"><span class="hs-identifier hs-var">mkLblExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681053109"><span class="hs-identifier hs-var">save_cccs_lbl</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CmmExpr -&gt; Maybe CmmExpr
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">CmmExpr
</span><a href="GHC.Cmm.Utils.html#cccsExpr"><span class="hs-identifier hs-var">cccsExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-380"></span><span>    </span><span id="local-6989586621681053109"><span class="annot"><span class="annottext">save_cccs_lbl :: CLabel
</span><a href="#local-6989586621681053109"><span class="hs-identifier hs-var hs-var">save_cccs_lbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnitId -&gt; FastString -&gt; CLabel
</span><a href="GHC.Cmm.CLabel.html#mkCmmRetInfoLabel"><span class="hs-identifier hs-var">mkCmmRetInfoLabel</span></a></span><span> </span><span class="annot"><span class="annottext">UnitId
</span><a href="GHC.Unit.Types.html#rtsUnitId"><span class="hs-identifier hs-var">rtsUnitId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;stg_restore_cccs&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-381"></span><span>
</span><span id="line-382"></span><span class="hs-comment">-------------------------------------------------------------------------</span><span>
</span><span id="line-383"></span><span class="hs-comment">----        Laying out objects on the heap and stack</span><span>
</span><span id="line-384"></span><span class="hs-comment">-------------------------------------------------------------------------</span><span>
</span><span id="line-385"></span><span>
</span><span id="line-386"></span><span class="hs-comment">-- The heap always grows upwards, so hpRel is easy to compute</span><span>
</span><span id="line-387"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#hpRel"><span class="hs-identifier hs-type">hpRel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#VirtualHpOffset"><span class="hs-identifier hs-type">VirtualHpOffset</span></a></span><span>         </span><span class="hs-comment">-- virtual offset of Hp</span><span>
</span><span id="line-388"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#VirtualHpOffset"><span class="hs-identifier hs-type">VirtualHpOffset</span></a></span><span>         </span><span class="hs-comment">-- virtual offset of The Thing</span><span>
</span><span id="line-389"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span>                </span><span class="hs-comment">-- integer word offset</span><span>
</span><span id="line-390"></span><span id="hpRel"><span class="annot"><span class="annottext">hpRel :: Int -&gt; Int -&gt; Int
</span><a href="GHC.StgToCmm.Layout.html#hpRel"><span class="hs-identifier hs-var hs-var">hpRel</span></a></span></span><span> </span><span id="local-6989586621681053103"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053103"><span class="hs-identifier hs-var">hp</span></a></span></span><span> </span><span id="local-6989586621681053102"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053102"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053102"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053103"><span class="hs-identifier hs-var">hp</span></a></span><span>
</span><span id="line-391"></span><span>
</span><span id="line-392"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#getHpRelOffset"><span class="hs-identifier hs-type">getHpRelOffset</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#VirtualHpOffset"><span class="hs-identifier hs-type">VirtualHpOffset</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmExpr"><span class="hs-identifier hs-type">CmmExpr</span></a></span><span>
</span><span id="line-393"></span><span class="hs-comment">-- See Note [Virtual and real heap pointers] in GHC.StgToCmm.Monad</span><span>
</span><span id="line-394"></span><span id="getHpRelOffset"><span class="annot"><span class="annottext">getHpRelOffset :: Int -&gt; FCode CmmExpr
</span><a href="GHC.StgToCmm.Layout.html#getHpRelOffset"><span class="hs-identifier hs-var hs-var">getHpRelOffset</span></a></span></span><span> </span><span id="local-6989586621681053101"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053101"><span class="hs-identifier hs-var">virtual_offset</span></a></span></span><span>
</span><span id="line-395"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681053100"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053100"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Platform
</span><a href="GHC.StgToCmm.Monad.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-396"></span><span>       </span><span id="local-6989586621681053099"><span class="annot"><span class="annottext">HeapUsage
</span><a href="#local-6989586621681053099"><span class="hs-identifier hs-var">hp_usg</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode HeapUsage
</span><a href="GHC.StgToCmm.Monad.html#getHpUsage"><span class="hs-identifier hs-var">getHpUsage</span></a></span><span>
</span><span id="line-397"></span><span>       </span><span class="annot"><span class="annottext">CmmExpr -&gt; FCode CmmExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; CmmReg -&gt; Int -&gt; CmmExpr
</span><a href="GHC.Cmm.Utils.html#cmmRegOffW"><span class="hs-identifier hs-var">cmmRegOffW</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053100"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">CmmReg
</span><a href="GHC.Cmm.Expr.html#hpReg"><span class="hs-identifier hs-var">hpReg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="GHC.StgToCmm.Layout.html#hpRel"><span class="hs-identifier hs-var">hpRel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HeapUsage -&gt; Int
</span><a href="GHC.StgToCmm.Monad.html#realHp"><span class="hs-identifier hs-var hs-var">realHp</span></a></span><span> </span><span class="annot"><span class="annottext">HeapUsage
</span><a href="#local-6989586621681053099"><span class="hs-identifier hs-var">hp_usg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053101"><span class="hs-identifier hs-var">virtual_offset</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-398"></span><span>
</span><span id="line-399"></span><span class="hs-keyword">data</span><span> </span><span id="FieldOffOrPadding"><span class="annot"><a href="GHC.StgToCmm.Layout.html#FieldOffOrPadding"><span class="hs-identifier hs-var">FieldOffOrPadding</span></a></span></span><span> </span><span id="local-6989586621681053445"><span class="annot"><a href="#local-6989586621681053445"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-400"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="FieldOff"><span class="annot"><a href="GHC.StgToCmm.Layout.html#FieldOff"><span class="hs-identifier hs-var">FieldOff</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681053445"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Something that needs an offset.</span><span>
</span><span id="line-401"></span><span>               </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span>     </span><span class="hs-comment">-- Offset in bytes.</span><span>
</span><span id="line-402"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span id="Padding"><span class="annot"><a href="GHC.StgToCmm.Layout.html#Padding"><span class="hs-identifier hs-var">Padding</span></a></span></span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span>  </span><span class="hs-comment">-- Length of padding in bytes.</span><span>
</span><span id="line-403"></span><span>              </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span>  </span><span class="hs-comment">-- Offset in bytes.</span><span>
</span><span id="line-404"></span><span>
</span><span id="line-405"></span><span class="hs-comment">-- | Used to tell the various @mkVirtHeapOffsets@ functions what kind</span><span>
</span><span id="line-406"></span><span class="hs-comment">-- of header the object has.  This will be accounted for in the</span><span>
</span><span id="line-407"></span><span class="hs-comment">-- offsets of the fields returned.</span><span>
</span><span id="line-408"></span><span class="hs-keyword">data</span><span> </span><span id="ClosureHeader"><span class="annot"><a href="GHC.StgToCmm.Layout.html#ClosureHeader"><span class="hs-identifier hs-var">ClosureHeader</span></a></span></span><span>
</span><span id="line-409"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="NoHeader"><span class="annot"><a href="GHC.StgToCmm.Layout.html#NoHeader"><span class="hs-identifier hs-var">NoHeader</span></a></span></span><span>
</span><span id="line-410"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="StdHeader"><span class="annot"><a href="GHC.StgToCmm.Layout.html#StdHeader"><span class="hs-identifier hs-var">StdHeader</span></a></span></span><span>
</span><span id="line-411"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ThunkHeader"><span class="annot"><a href="GHC.StgToCmm.Layout.html#ThunkHeader"><span class="hs-identifier hs-var">ThunkHeader</span></a></span></span><span>
</span><span id="line-412"></span><span>
</span><span id="line-413"></span><span id="local-6989586621681053462"><span class="annot"><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsetsWithPadding"><span class="hs-identifier hs-type">mkVirtHeapOffsetsWithPadding</span></a></span><span>
</span><span id="line-414"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-415"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#ClosureHeader"><span class="hs-identifier hs-type">ClosureHeader</span></a></span><span>            </span><span class="hs-comment">-- What kind of header to account for</span><span>
</span><span id="line-416"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCon.html#PrimRep"><span class="hs-identifier hs-type">PrimRep</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681053462"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>   </span><span class="hs-comment">-- Things to make offsets for</span><span>
</span><span id="line-417"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span>                </span><span class="hs-comment">-- Total number of words allocated</span><span>
</span><span id="line-418"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span>                </span><span class="hs-comment">-- Number of words allocated for *pointers*</span><span>
</span><span id="line-419"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.Layout.html#FieldOffOrPadding"><span class="hs-identifier hs-type">FieldOffOrPadding</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681053462"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- Either an offset or padding.</span><span>
</span><span id="line-420"></span><span>     </span><span class="hs-special">)</span></span><span>
</span><span id="line-421"></span><span>
</span><span id="line-422"></span><span class="hs-comment">-- Things with their offsets from start of object in order of</span><span>
</span><span id="line-423"></span><span class="hs-comment">-- increasing offset; BUT THIS MAY BE DIFFERENT TO INPUT ORDER</span><span>
</span><span id="line-424"></span><span class="hs-comment">-- First in list gets lowest offset, which is initial offset + 1.</span><span>
</span><span id="line-425"></span><span class="hs-comment">--</span><span>
</span><span id="line-426"></span><span class="hs-comment">-- mkVirtHeapOffsetsWithPadding always returns boxed things with smaller offsets</span><span>
</span><span id="line-427"></span><span class="hs-comment">-- than the unboxed things</span><span>
</span><span id="line-428"></span><span>
</span><span id="line-429"></span><span id="mkVirtHeapOffsetsWithPadding"><span class="annot"><span class="annottext">mkVirtHeapOffsetsWithPadding :: forall a.
DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, a)]
-&gt; (Int, Int, [FieldOffOrPadding a])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsetsWithPadding"><span class="hs-identifier hs-var hs-var">mkVirtHeapOffsetsWithPadding</span></a></span></span><span> </span><span id="local-6989586621681053089"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053089"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681053088"><span class="annot"><span class="annottext">ClosureHeader
</span><a href="#local-6989586621681053088"><span class="hs-identifier hs-var">header</span></a></span></span><span> </span><span id="local-6989586621681053087"><span class="annot"><span class="annottext">[NonVoid (PrimRep, a)]
</span><a href="#local-6989586621681053087"><span class="hs-identifier hs-var">things</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-430"></span><span>    </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">any</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">isVoidRep</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">fst</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">fromNonVoid</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">things</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-431"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053081"><span class="hs-identifier hs-var">tot_wds</span></a></span><span>
</span><span id="line-432"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Int -&gt; Int
</span><a href="GHC.Runtime.Heap.Layout.html#bytesToWordsRoundUp"><span class="hs-identifier hs-var">bytesToWordsRoundUp</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053079"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053078"><span class="hs-identifier hs-var">bytes_of_ptrs</span></a></span><span>
</span><span id="line-433"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[[FieldOffOrPadding a]] -&gt; [FieldOffOrPadding a]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[FieldOffOrPadding a]]
</span><a href="#local-6989586621681053076"><span class="hs-identifier hs-var">ptrs_w_offsets</span></a></span><span> </span><span class="annot"><span class="annottext">[[FieldOffOrPadding a]]
-&gt; [[FieldOffOrPadding a]] -&gt; [[FieldOffOrPadding a]]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[[FieldOffOrPadding a]]
</span><a href="#local-6989586621681053075"><span class="hs-identifier hs-var">non_ptrs_w_offsets</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[FieldOffOrPadding a]
-&gt; [FieldOffOrPadding a] -&gt; [FieldOffOrPadding a]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldOffOrPadding a]
forall {a}. [FieldOffOrPadding a]
</span><a href="#local-6989586621681053074"><span class="hs-identifier hs-var">final_pad</span></a></span><span>
</span><span id="line-434"></span><span>    </span><span class="hs-special">)</span><span>
</span><span id="line-435"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-436"></span><span>    </span><span id="local-6989586621681053079"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681053079"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053089"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-437"></span><span>    </span><span id="local-6989586621681053071"><span class="annot"><span class="annottext">hdr_words :: Int
</span><a href="#local-6989586621681053071"><span class="hs-identifier hs-var hs-var">hdr_words</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="#local-6989586621681053088"><span class="hs-identifier hs-var">header</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-438"></span><span>      </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#NoHeader"><span class="hs-identifier hs-var">NoHeader</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-439"></span><span>      </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#StdHeader"><span class="hs-identifier hs-var">StdHeader</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Int
</span><a href="GHC.Runtime.Heap.Layout.html#fixedHdrSizeW"><span class="hs-identifier hs-var">fixedHdrSizeW</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053089"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-440"></span><span>      </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#ThunkHeader"><span class="hs-identifier hs-var">ThunkHeader</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Int
</span><a href="GHC.Runtime.Heap.Layout.html#thunkHdrSize"><span class="hs-identifier hs-var">thunkHdrSize</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053089"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-441"></span><span>    </span><span id="local-6989586621681053067"><span class="annot"><span class="annottext">hdr_bytes :: Int
</span><a href="#local-6989586621681053067"><span class="hs-identifier hs-var hs-var">hdr_bytes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Int -&gt; Int
forall a. Num a =&gt; Platform -&gt; a -&gt; a
</span><a href="GHC.Runtime.Heap.Layout.html#wordsToBytes"><span class="hs-identifier hs-var">wordsToBytes</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053079"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053071"><span class="hs-identifier hs-var">hdr_words</span></a></span><span>
</span><span id="line-442"></span><span>
</span><span id="line-443"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053065"><span class="annot"><span class="annottext">[NonVoid (PrimRep, a)]
</span><a href="#local-6989586621681053065"><span class="hs-identifier hs-var">ptrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053064"><span class="annot"><span class="annottext">[NonVoid (PrimRep, a)]
</span><a href="#local-6989586621681053064"><span class="hs-identifier hs-var">non_ptrs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(NonVoid (PrimRep, a) -&gt; Bool)
-&gt; [NonVoid (PrimRep, a)]
-&gt; ([NonVoid (PrimRep, a)], [NonVoid (PrimRep, a)])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PrimRep -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isGcPtrRep"><span class="hs-identifier hs-var">isGcPtrRep</span></a></span><span> </span><span class="annot"><span class="annottext">(PrimRep -&gt; Bool)
-&gt; (NonVoid (PrimRep, a) -&gt; PrimRep)
-&gt; NonVoid (PrimRep, a)
-&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(PrimRep, a) -&gt; PrimRep
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">((PrimRep, a) -&gt; PrimRep)
-&gt; (NonVoid (PrimRep, a) -&gt; (PrimRep, a))
-&gt; NonVoid (PrimRep, a)
-&gt; PrimRep
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">NonVoid (PrimRep, a) -&gt; (PrimRep, a)
forall a. NonVoid a -&gt; a
</span><a href="GHC.StgToCmm.Closure.html#fromNonVoid"><span class="hs-identifier hs-var">fromNonVoid</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[NonVoid (PrimRep, a)]
</span><a href="#local-6989586621681053087"><span class="hs-identifier hs-var">things</span></a></span><span>
</span><span id="line-444"></span><span>
</span><span id="line-445"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053078"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053078"><span class="hs-identifier hs-var">bytes_of_ptrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053076"><span class="annot"><span class="annottext">[[FieldOffOrPadding a]]
</span><a href="#local-6989586621681053076"><span class="hs-identifier hs-var">ptrs_w_offsets</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-446"></span><span>       </span><span class="annot"><span class="annottext">(Int -&gt; NonVoid (PrimRep, a) -&gt; (Int, [FieldOffOrPadding a]))
-&gt; Int -&gt; [NonVoid (PrimRep, a)] -&gt; (Int, [[FieldOffOrPadding a]])
forall (t :: * -&gt; *) s a b.
Traversable t =&gt;
(s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b)
</span><a href="../../base/src/Data.Traversable.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; NonVoid (PrimRep, a) -&gt; (Int, [FieldOffOrPadding a])
forall {a}.
Int -&gt; NonVoid (PrimRep, a) -&gt; (Int, [FieldOffOrPadding a])
</span><a href="#local-6989586621681053058"><span class="hs-identifier hs-var">computeOffset</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">[NonVoid (PrimRep, a)]
</span><a href="#local-6989586621681053065"><span class="hs-identifier hs-var">ptrs</span></a></span><span>
</span><span id="line-447"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053056"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053056"><span class="hs-identifier hs-var">tot_bytes</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053075"><span class="annot"><span class="annottext">[[FieldOffOrPadding a]]
</span><a href="#local-6989586621681053075"><span class="hs-identifier hs-var">non_ptrs_w_offsets</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-448"></span><span>       </span><span class="annot"><span class="annottext">(Int -&gt; NonVoid (PrimRep, a) -&gt; (Int, [FieldOffOrPadding a]))
-&gt; Int -&gt; [NonVoid (PrimRep, a)] -&gt; (Int, [[FieldOffOrPadding a]])
forall (t :: * -&gt; *) s a b.
Traversable t =&gt;
(s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b)
</span><a href="../../base/src/Data.Traversable.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; NonVoid (PrimRep, a) -&gt; (Int, [FieldOffOrPadding a])
forall {a}.
Int -&gt; NonVoid (PrimRep, a) -&gt; (Int, [FieldOffOrPadding a])
</span><a href="#local-6989586621681053058"><span class="hs-identifier hs-var">computeOffset</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053078"><span class="hs-identifier hs-var">bytes_of_ptrs</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid (PrimRep, a)]
</span><a href="#local-6989586621681053064"><span class="hs-identifier hs-var">non_ptrs</span></a></span><span>
</span><span id="line-449"></span><span>
</span><span id="line-450"></span><span>    </span><span id="local-6989586621681053081"><span class="annot"><span class="annottext">tot_wds :: Int
</span><a href="#local-6989586621681053081"><span class="hs-identifier hs-var hs-var">tot_wds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Int -&gt; Int
</span><a href="GHC.Runtime.Heap.Layout.html#bytesToWordsRoundUp"><span class="hs-identifier hs-var">bytesToWordsRoundUp</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053079"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053056"><span class="hs-identifier hs-var">tot_bytes</span></a></span><span>
</span><span id="line-451"></span><span>
</span><span id="line-452"></span><span>    </span><span id="local-6989586621681053053"><span class="annot"><span class="annottext">final_pad_size :: Int
</span><a href="#local-6989586621681053053"><span class="hs-identifier hs-var hs-var">final_pad_size</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053081"><span class="hs-identifier hs-var">tot_wds</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053051"><span class="hs-identifier hs-var">word_size</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053056"><span class="hs-identifier hs-var">tot_bytes</span></a></span><span>
</span><span id="line-453"></span><span>    </span><span id="local-6989586621681053074"><span class="annot"><span class="annottext">final_pad :: [FieldOffOrPadding a]
</span><a href="#local-6989586621681053074"><span class="hs-identifier hs-var hs-var">final_pad</span></a></span></span><span>
</span><span id="line-454"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053053"><span class="hs-identifier hs-var">final_pad_size</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; FieldOffOrPadding a
forall a. Int -&gt; Int -&gt; FieldOffOrPadding a
</span><a href="GHC.StgToCmm.Layout.html#Padding"><span class="hs-identifier hs-var">Padding</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053053"><span class="hs-identifier hs-var">final_pad_size</span></a></span><span>
</span><span id="line-455"></span><span>                                         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053067"><span class="hs-identifier hs-var">hdr_bytes</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053056"><span class="hs-identifier hs-var">tot_bytes</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-456"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-457"></span><span>
</span><span id="line-458"></span><span>    </span><span id="local-6989586621681053051"><span class="annot"><span class="annottext">word_size :: Int
</span><a href="#local-6989586621681053051"><span class="hs-identifier hs-var hs-var">word_size</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Int
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformWordSizeInBytes"><span class="hs-identifier hs-var">platformWordSizeInBytes</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053079"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-459"></span><span>
</span><span id="line-460"></span><span>    </span><span id="local-6989586621681053058"><span class="annot"><span class="annottext">computeOffset :: Int -&gt; NonVoid (PrimRep, a) -&gt; (Int, [FieldOffOrPadding a])
</span><a href="#local-6989586621681053058"><span class="hs-identifier hs-var hs-var">computeOffset</span></a></span></span><span> </span><span id="local-6989586621681053046"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053046"><span class="hs-identifier hs-var">bytes_so_far</span></a></span></span><span> </span><span id="local-6989586621681053045"><span class="annot"><span class="annottext">NonVoid (PrimRep, a)
</span><a href="#local-6989586621681053045"><span class="hs-identifier hs-var">nv_thing</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-461"></span><span>        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053044"><span class="hs-identifier hs-var">new_bytes_so_far</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FieldOffOrPadding a -&gt; [FieldOffOrPadding a]
forall {a}. FieldOffOrPadding a -&gt; [FieldOffOrPadding a]
</span><a href="#local-6989586621681053043"><span class="hs-identifier hs-var">with_padding</span></a></span><span> </span><span class="annot"><span class="annottext">FieldOffOrPadding a
</span><a href="#local-6989586621681053042"><span class="hs-identifier hs-var">field_off</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-462"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-463"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681053041"><span class="annot"><span class="annottext">PrimRep
</span><a href="#local-6989586621681053041"><span class="hs-identifier hs-var">rep</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053040"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681053040"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NonVoid (PrimRep, a) -&gt; (PrimRep, a)
forall a. NonVoid a -&gt; a
</span><a href="GHC.StgToCmm.Closure.html#fromNonVoid"><span class="hs-identifier hs-var">fromNonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">NonVoid (PrimRep, a)
</span><a href="#local-6989586621681053045"><span class="hs-identifier hs-var">nv_thing</span></a></span><span>
</span><span id="line-464"></span><span>
</span><span id="line-465"></span><span>        </span><span class="hs-comment">-- Size of the field in bytes.</span><span>
</span><span id="line-466"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621681053039"><span class="annot"><span class="annottext">sizeB :: Int
</span><a href="#local-6989586621681053039"><span class="hs-identifier hs-var hs-var">sizeB</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; PrimRep -&gt; Int
</span><a href="GHC.Core.TyCon.html#primRepSizeB"><span class="hs-identifier hs-var">primRepSizeB</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053079"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">PrimRep
</span><a href="#local-6989586621681053041"><span class="hs-identifier hs-var">rep</span></a></span><span>
</span><span id="line-467"></span><span>
</span><span id="line-468"></span><span>        </span><span class="hs-comment">-- Align the start offset (eg, 2-byte value should be 2-byte aligned).</span><span>
</span><span id="line-469"></span><span>        </span><span class="hs-comment">-- But not more than to a word.</span><span>
</span><span id="line-470"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621681053037"><span class="annot"><span class="annottext">align :: Int
</span><a href="#local-6989586621681053037"><span class="hs-identifier hs-var hs-var">align</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier hs-var">min</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053051"><span class="hs-identifier hs-var">word_size</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053039"><span class="hs-identifier hs-var">sizeB</span></a></span><span>
</span><span id="line-471"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621681053035"><span class="annot"><span class="annottext">start :: Int
</span><a href="#local-6989586621681053035"><span class="hs-identifier hs-var hs-var">start</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="GHC.Runtime.Heap.Layout.html#roundUpTo"><span class="hs-identifier hs-var">roundUpTo</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053046"><span class="hs-identifier hs-var">bytes_so_far</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053037"><span class="hs-identifier hs-var">align</span></a></span><span>
</span><span id="line-472"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621681053032"><span class="annot"><span class="annottext">padding :: Int
</span><a href="#local-6989586621681053032"><span class="hs-identifier hs-var hs-var">padding</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053035"><span class="hs-identifier hs-var">start</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053046"><span class="hs-identifier hs-var">bytes_so_far</span></a></span><span>
</span><span id="line-473"></span><span>
</span><span id="line-474"></span><span>        </span><span class="hs-comment">-- Final offset is:</span><span>
</span><span id="line-475"></span><span>        </span><span class="hs-comment">--   size of header + bytes_so_far + padding</span><span>
</span><span id="line-476"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621681053029"><span class="annot"><span class="annottext">final_offset :: Int
</span><a href="#local-6989586621681053029"><span class="hs-identifier hs-var hs-var">final_offset</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053067"><span class="hs-identifier hs-var">hdr_bytes</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053046"><span class="hs-identifier hs-var">bytes_so_far</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053032"><span class="hs-identifier hs-var">padding</span></a></span><span>
</span><span id="line-477"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621681053044"><span class="annot"><span class="annottext">new_bytes_so_far :: Int
</span><a href="#local-6989586621681053044"><span class="hs-identifier hs-var hs-var">new_bytes_so_far</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053035"><span class="hs-identifier hs-var">start</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053039"><span class="hs-identifier hs-var">sizeB</span></a></span><span>
</span><span id="line-478"></span><span>        </span><span id="local-6989586621681053042"><span class="annot"><span class="annottext">field_off :: FieldOffOrPadding a
</span><a href="#local-6989586621681053042"><span class="hs-identifier hs-var hs-var">field_off</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NonVoid a -&gt; Int -&gt; FieldOffOrPadding a
forall a. NonVoid a -&gt; Int -&gt; FieldOffOrPadding a
</span><a href="GHC.StgToCmm.Layout.html#FieldOff"><span class="hs-identifier hs-var">FieldOff</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; NonVoid a
forall a. a -&gt; NonVoid a
</span><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-var">NonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681053040"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053029"><span class="hs-identifier hs-var">final_offset</span></a></span><span>
</span><span id="line-479"></span><span>
</span><span id="line-480"></span><span>        </span><span id="local-6989586621681053043"><span class="annot"><span class="annottext">with_padding :: FieldOffOrPadding a -&gt; [FieldOffOrPadding a]
</span><a href="#local-6989586621681053043"><span class="hs-identifier hs-var hs-var">with_padding</span></a></span></span><span> </span><span id="local-6989586621681053024"><span class="annot"><span class="annottext">FieldOffOrPadding a
</span><a href="#local-6989586621681053024"><span class="hs-identifier hs-var">field_off</span></a></span></span><span>
</span><span id="line-481"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053032"><span class="hs-identifier hs-var">padding</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">FieldOffOrPadding a
</span><a href="#local-6989586621681053024"><span class="hs-identifier hs-var">field_off</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-482"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; FieldOffOrPadding a
forall a. Int -&gt; Int -&gt; FieldOffOrPadding a
</span><a href="GHC.StgToCmm.Layout.html#Padding"><span class="hs-identifier hs-var">Padding</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053032"><span class="hs-identifier hs-var">padding</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053067"><span class="hs-identifier hs-var">hdr_bytes</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053046"><span class="hs-identifier hs-var">bytes_so_far</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-483"></span><span>                             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FieldOffOrPadding a
</span><a href="#local-6989586621681053024"><span class="hs-identifier hs-var">field_off</span></a></span><span>
</span><span id="line-484"></span><span>                             </span><span class="hs-special">]</span><span>
</span><span id="line-485"></span><span>
</span><span id="line-486"></span><span>
</span><span id="line-487"></span><span id="local-6989586621681053443"><span class="annot"><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsets"><span class="hs-identifier hs-type">mkVirtHeapOffsets</span></a></span><span>
</span><span id="line-488"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-489"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Layout.html#ClosureHeader"><span class="hs-identifier hs-type">ClosureHeader</span></a></span><span>            </span><span class="hs-comment">-- What kind of header to account for</span><span>
</span><span id="line-490"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCon.html#PrimRep"><span class="hs-identifier hs-type">PrimRep</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621681053443"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>    </span><span class="hs-comment">-- Things to make offsets for</span><span>
</span><span id="line-491"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- _Total_ number of words allocated</span><span>
</span><span id="line-492"></span><span>      </span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span class="hs-special">,</span><span>                </span><span class="hs-comment">-- Number of words allocated for *pointers*</span><span>
</span><span id="line-493"></span><span>      </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681053443"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-494"></span><span id="mkVirtHeapOffsets"><span class="annot"><span class="annottext">mkVirtHeapOffsets :: forall a.
DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, a)]
-&gt; (Int, Int, [(NonVoid a, Int)])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsets"><span class="hs-identifier hs-var hs-var">mkVirtHeapOffsets</span></a></span></span><span> </span><span id="local-6989586621681053023"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053023"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681053022"><span class="annot"><span class="annottext">ClosureHeader
</span><a href="#local-6989586621681053022"><span class="hs-identifier hs-var">header</span></a></span></span><span> </span><span id="local-6989586621681053021"><span class="annot"><span class="annottext">[NonVoid (PrimRep, a)]
</span><a href="#local-6989586621681053021"><span class="hs-identifier hs-var">things</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-495"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053020"><span class="hs-identifier hs-var">tot_wds</span></a></span><span>
</span><span id="line-496"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053019"><span class="hs-identifier hs-var">ptr_wds</span></a></span><span>
</span><span id="line-497"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NonVoid a
</span><a href="#local-6989586621681053018"><span class="hs-identifier hs-var">field</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053017"><span class="hs-identifier hs-var">offset</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Layout.html#FieldOff"><span class="hs-identifier hs-type">FieldOff</span></a></span><span> </span><span id="local-6989586621681053018"><span class="annot"><span class="annottext">NonVoid a
</span><a href="#local-6989586621681053018"><span class="hs-identifier hs-var">field</span></a></span></span><span> </span><span id="local-6989586621681053017"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053017"><span class="hs-identifier hs-var">offset</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[FieldOffOrPadding a]
</span><a href="#local-6989586621681053016"><span class="hs-identifier hs-var">things_offsets</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-498"></span><span>    </span><span class="hs-special">)</span><span>
</span><span id="line-499"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-500"></span><span>   </span><span class="hs-special">(</span><span id="local-6989586621681053020"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053020"><span class="hs-identifier hs-var">tot_wds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053019"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053019"><span class="hs-identifier hs-var">ptr_wds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053016"><span class="annot"><span class="annottext">[FieldOffOrPadding a]
</span><a href="#local-6989586621681053016"><span class="hs-identifier hs-var">things_offsets</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-501"></span><span>       </span><span class="annot"><span class="annottext">DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, a)]
-&gt; (Int, Int, [FieldOffOrPadding a])
forall a.
DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, a)]
-&gt; (Int, Int, [FieldOffOrPadding a])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsetsWithPadding"><span class="hs-identifier hs-var">mkVirtHeapOffsetsWithPadding</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053023"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="#local-6989586621681053022"><span class="hs-identifier hs-var">header</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid (PrimRep, a)]
</span><a href="#local-6989586621681053021"><span class="hs-identifier hs-var">things</span></a></span><span>
</span><span id="line-502"></span><span>
</span><span id="line-503"></span><span class="hs-comment">-- | Just like mkVirtHeapOffsets, but for constructors</span><span>
</span><span id="line-504"></span><span id="local-6989586621681053441"><span class="annot"><a href="GHC.StgToCmm.Layout.html#mkVirtConstrOffsets"><span class="hs-identifier hs-type">mkVirtConstrOffsets</span></a></span><span>
</span><span id="line-505"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCon.html#PrimRep"><span class="hs-identifier hs-type">PrimRep</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681053441"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-506"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681053441"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Heap.Layout.html#ByteOff"><span class="hs-identifier hs-type">ByteOff</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-507"></span><span id="mkVirtConstrOffsets"><span class="annot"><span class="annottext">mkVirtConstrOffsets :: forall a.
DynFlags
-&gt; [NonVoid (PrimRep, a)] -&gt; (Int, Int, [(NonVoid a, Int)])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtConstrOffsets"><span class="hs-identifier hs-var hs-var">mkVirtConstrOffsets</span></a></span></span><span> </span><span id="local-6989586621681053015"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053015"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, a)]
-&gt; (Int, Int, [(NonVoid a, Int)])
forall a.
DynFlags
-&gt; ClosureHeader
-&gt; [NonVoid (PrimRep, a)]
-&gt; (Int, Int, [(NonVoid a, Int)])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtHeapOffsets"><span class="hs-identifier hs-var">mkVirtHeapOffsets</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053015"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ClosureHeader
</span><a href="GHC.StgToCmm.Layout.html#StdHeader"><span class="hs-identifier hs-var">StdHeader</span></a></span><span>
</span><span id="line-508"></span><span>
</span><span id="line-509"></span><span class="hs-comment">-- | Just like mkVirtConstrOffsets, but used when we don't have the actual</span><span>
</span><span id="line-510"></span><span class="hs-comment">-- arguments. Useful when e.g. generating info tables; we just need to know</span><span>
</span><span id="line-511"></span><span class="hs-comment">-- sizes of pointer and non-pointer fields.</span><span>
</span><span id="line-512"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#mkVirtConstrSizes"><span class="hs-identifier hs-type">mkVirtConstrSizes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#PrimRep"><span class="hs-identifier hs-type">PrimRep</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#WordOff"><span class="hs-identifier hs-type">WordOff</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-513"></span><span id="mkVirtConstrSizes"><span class="annot"><span class="annottext">mkVirtConstrSizes :: DynFlags -&gt; [NonVoid PrimRep] -&gt; (Int, Int)
</span><a href="GHC.StgToCmm.Layout.html#mkVirtConstrSizes"><span class="hs-identifier hs-var hs-var">mkVirtConstrSizes</span></a></span></span><span> </span><span id="local-6989586621681053014"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053014"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681053013"><span class="annot"><span class="annottext">[NonVoid PrimRep]
</span><a href="#local-6989586621681053013"><span class="hs-identifier hs-var">field_reps</span></a></span></span><span>
</span><span id="line-514"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053012"><span class="hs-identifier hs-var">tot_wds</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053011"><span class="hs-identifier hs-var">ptr_wds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-515"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-516"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681053012"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053012"><span class="hs-identifier hs-var">tot_wds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681053011"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053011"><span class="hs-identifier hs-var">ptr_wds</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(NonVoid (), Int)]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-517"></span><span>       </span><span class="annot"><span class="annottext">DynFlags
-&gt; [NonVoid (PrimRep, ())] -&gt; (Int, Int, [(NonVoid (), Int)])
forall a.
DynFlags
-&gt; [NonVoid (PrimRep, a)] -&gt; (Int, Int, [(NonVoid a, Int)])
</span><a href="GHC.StgToCmm.Layout.html#mkVirtConstrOffsets"><span class="hs-identifier hs-var">mkVirtConstrOffsets</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681053014"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-518"></span><span>         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(NonVoid PrimRep -&gt; NonVoid (PrimRep, ()))
-&gt; [NonVoid PrimRep] -&gt; [NonVoid (PrimRep, ())]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681053010"><span class="annot"><span class="annottext">NonVoid PrimRep
</span><a href="#local-6989586621681053010"><span class="hs-identifier hs-var">nv_rep</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(PrimRep, ()) -&gt; NonVoid (PrimRep, ())
forall a. a -&gt; NonVoid a
</span><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-var">NonVoid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NonVoid PrimRep -&gt; PrimRep
forall a. NonVoid a -&gt; a
</span><a href="GHC.StgToCmm.Closure.html#fromNonVoid"><span class="hs-identifier hs-var">fromNonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">NonVoid PrimRep
</span><a href="#local-6989586621681053010"><span class="hs-identifier hs-var">nv_rep</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[NonVoid PrimRep]
</span><a href="#local-6989586621681053013"><span class="hs-identifier hs-var">field_reps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-519"></span><span>
</span><span id="line-520"></span><span class="hs-comment">-------------------------------------------------------------------------</span><span>
</span><span id="line-521"></span><span class="hs-comment">--</span><span>
</span><span id="line-522"></span><span class="hs-comment">--        Making argument descriptors</span><span>
</span><span id="line-523"></span><span class="hs-comment">--</span><span>
</span><span id="line-524"></span><span class="hs-comment">--  An argument descriptor describes the layout of args on the stack,</span><span>
</span><span id="line-525"></span><span class="hs-comment">--  both for         * GC (stack-layout) purposes, and</span><span>
</span><span id="line-526"></span><span class="hs-comment">--                * saving/restoring registers when a heap-check fails</span><span>
</span><span id="line-527"></span><span class="hs-comment">--</span><span>
</span><span id="line-528"></span><span class="hs-comment">-- Void arguments aren't important, therefore (contrast constructSlowCall)</span><span>
</span><span id="line-529"></span><span class="hs-comment">--</span><span>
</span><span id="line-530"></span><span class="hs-comment">-------------------------------------------------------------------------</span><span>
</span><span id="line-531"></span><span>
</span><span id="line-532"></span><span class="hs-comment">-- bring in ARG_P, ARG_N, etc.</span><span class="hs-cpp">
#include &quot;../includes/rts/storage/FunTypes.h&quot;
</span><span>
</span><span id="line-535"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#mkArgDescr"><span class="hs-identifier hs-type">mkArgDescr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#ArgDescr"><span class="hs-identifier hs-type">ArgDescr</span></a></span><span>
</span><span id="line-536"></span><span id="mkArgDescr"><span class="annot"><span class="annottext">mkArgDescr :: Platform -&gt; [Id] -&gt; ArgDescr
</span><a href="GHC.StgToCmm.Layout.html#mkArgDescr"><span class="hs-identifier hs-var hs-var">mkArgDescr</span></a></span></span><span> </span><span id="local-6989586621681053009"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053009"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span id="local-6989586621681053008"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053008"><span class="hs-identifier hs-var">args</span></a></span></span><span>
</span><span id="line-537"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681053007"><span class="annot"><span class="annottext">arg_bits :: [Bool]
</span><a href="#local-6989586621681053007"><span class="hs-identifier hs-var hs-var">arg_bits</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; [ArgRep] -&gt; [Bool]
</span><a href="GHC.StgToCmm.Layout.html#argBits"><span class="hs-identifier hs-var">argBits</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681053009"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgRep]
</span><a href="#local-6989586621681053005"><span class="hs-identifier hs-var">arg_reps</span></a></span><span>
</span><span id="line-538"></span><span>        </span><span id="local-6989586621681053005"><span class="annot"><span class="annottext">arg_reps :: [ArgRep]
</span><a href="#local-6989586621681053005"><span class="hs-identifier hs-var hs-var">arg_reps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ArgRep -&gt; Bool) -&gt; [ArgRep] -&gt; [ArgRep]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">ArgRep -&gt; Bool
</span><a href="GHC.StgToCmm.ArgRep.html#isNonV"><span class="hs-identifier hs-var">isNonV</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Id -&gt; ArgRep) -&gt; [Id] -&gt; [ArgRep]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#idArgRep"><span class="hs-identifier hs-var">idArgRep</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681053008"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-539"></span><span>           </span><span class="hs-comment">-- Getting rid of voids eases matching of standard patterns</span><span>
</span><span id="line-540"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[ArgRep] -&gt; Maybe Int
</span><a href="GHC.StgToCmm.Layout.html#stdPattern"><span class="hs-identifier hs-var">stdPattern</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgRep]
</span><a href="#local-6989586621681053005"><span class="hs-identifier hs-var">arg_reps</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-541"></span><span>         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681053001"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053001"><span class="hs-identifier hs-var">spec_id</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ArgDescr
</span><a href="GHC.StgToCmm.Types.html#ArgSpec"><span class="hs-identifier hs-var">ArgSpec</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681053001"><span class="hs-identifier hs-var">spec_id</span></a></span><span>
</span><span id="line-542"></span><span>         </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; ArgDescr
</span><a href="GHC.StgToCmm.Types.html#ArgGen"><span class="hs-identifier hs-var">ArgGen</span></a></span><span>  </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621681053007"><span class="hs-identifier hs-var">arg_bits</span></a></span><span>
</span><span id="line-543"></span><span>
</span><span id="line-544"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#argBits"><span class="hs-identifier hs-type">argBits</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html#ArgRep"><span class="hs-identifier hs-type">ArgRep</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">]</span><span>        </span><span class="hs-comment">-- True for non-ptr, False for ptr</span><span>
</span><span id="line-545"></span><span id="argBits"><span class="annot"><span class="annottext">argBits :: Platform -&gt; [ArgRep] -&gt; [Bool]
</span><a href="GHC.StgToCmm.Layout.html#argBits"><span class="hs-identifier hs-var hs-var">argBits</span></a></span></span><span> </span><span class="annot"><span class="annottext">Platform
</span><span class="hs-identifier">_</span></span><span>         </span><span class="hs-special">[</span><span class="hs-special">]</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-546"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#argBits"><span class="hs-identifier hs-var">argBits</span></a></span><span> </span><span id="local-6989586621681052998"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681052998"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span>   </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681052997"><span class="annot"><span class="annottext">[ArgRep]
</span><a href="#local-6989586621681052997"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; [Bool] -&gt; [Bool]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; [ArgRep] -&gt; [Bool]
</span><a href="GHC.StgToCmm.Layout.html#argBits"><span class="hs-identifier hs-var">argBits</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681052998"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgRep]
</span><a href="#local-6989586621681052997"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-547"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#argBits"><span class="hs-identifier hs-var">argBits</span></a></span><span> </span><span id="local-6989586621681052996"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681052996"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681052995"><span class="annot"><span class="annottext">ArgRep
</span><a href="#local-6989586621681052995"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681052994"><span class="annot"><span class="annottext">[ArgRep]
</span><a href="#local-6989586621681052994"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Bool] -&gt; [Bool]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; ArgRep -&gt; Int
</span><a href="GHC.StgToCmm.ArgRep.html#argRepSizeW"><span class="hs-identifier hs-var">argRepSizeW</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681052996"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">ArgRep
</span><a href="#local-6989586621681052995"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; [Bool]
forall a. a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#repeat"><span class="hs-identifier hs-var">repeat</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>
</span><span id="line-548"></span><span>                                 </span><span class="annot"><span class="annottext">[Bool] -&gt; [Bool] -&gt; [Bool]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; [ArgRep] -&gt; [Bool]
</span><a href="GHC.StgToCmm.Layout.html#argBits"><span class="hs-identifier hs-var">argBits</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681052996"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgRep]
</span><a href="#local-6989586621681052994"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-549"></span><span>
</span><span id="line-550"></span><span class="hs-comment">----------------------</span><span>
</span><span id="line-551"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#stdPattern"><span class="hs-identifier hs-type">stdPattern</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.ArgRep.html#ArgRep"><span class="hs-identifier hs-type">ArgRep</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-552"></span><span id="stdPattern"><span class="annot"><span class="annottext">stdPattern :: [ArgRep] -&gt; Maybe Int
</span><a href="GHC.StgToCmm.Layout.html#stdPattern"><span class="hs-identifier hs-var hs-var">stdPattern</span></a></span></span><span> </span><span id="local-6989586621681052991"><span class="annot"><span class="annottext">[ArgRep]
</span><a href="#local-6989586621681052991"><span class="hs-identifier hs-var">reps</span></a></span></span><span>
</span><span id="line-553"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[ArgRep]
</span><a href="#local-6989586621681052991"><span class="hs-identifier hs-var">reps</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-554"></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_NONE</span><span>        </span><span class="hs-comment">-- just void args, probably</span><span>
</span><span id="line-555"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_N</span><span>
</span><span id="line-556"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_P</span><span>
</span><span id="line-557"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#F"><span class="hs-identifier hs-var">F</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_F</span><span>
</span><span id="line-558"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#D"><span class="hs-identifier hs-var">D</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_D</span><span>
</span><span id="line-559"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#L"><span class="hs-identifier hs-var">L</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_L</span><span>
</span><span id="line-560"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#V16"><span class="hs-identifier hs-var">V16</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_V16</span><span>
</span><span id="line-561"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#V32"><span class="hs-identifier hs-var">V32</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_V32</span><span>
</span><span id="line-562"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#V64"><span class="hs-identifier hs-var">V64</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_V64</span><span>
</span><span id="line-563"></span><span>
</span><span id="line-564"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_NN</span><span>
</span><span id="line-565"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_NP</span><span>
</span><span id="line-566"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_PN</span><span>
</span><span id="line-567"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_PP</span><span>
</span><span id="line-568"></span><span>
</span><span id="line-569"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_NNN</span><span>
</span><span id="line-570"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_NNP</span><span>
</span><span id="line-571"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_NPN</span><span>
</span><span id="line-572"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_NPP</span><span>
</span><span id="line-573"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_PNN</span><span>
</span><span id="line-574"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_PNP</span><span>
</span><span id="line-575"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#N"><span class="hs-identifier hs-var">N</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_PPN</span><span>
</span><span id="line-576"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_PPP</span><span>
</span><span id="line-577"></span><span>
</span><span id="line-578"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_PPPP</span><span>
</span><span id="line-579"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_PPPPP</span><span>
</span><span id="line-580"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgRep
</span><a href="GHC.StgToCmm.ArgRep.html#P"><span class="hs-identifier hs-var">P</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-identifier">ARG_PPPPPP</span><span>
</span><span id="line-581"></span><span>
</span><span id="line-582"></span><span>        </span><span class="annot"><span class="annottext">[ArgRep]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-583"></span><span>
</span><span id="line-584"></span><span class="hs-comment">-------------------------------------------------------------------------</span><span>
</span><span id="line-585"></span><span class="hs-comment">--</span><span>
</span><span id="line-586"></span><span class="hs-comment">--        Generating the info table and code for a closure</span><span>
</span><span id="line-587"></span><span class="hs-comment">--</span><span>
</span><span id="line-588"></span><span class="hs-comment">-------------------------------------------------------------------------</span><span>
</span><span id="line-589"></span><span>
</span><span id="line-590"></span><span class="hs-comment">-- Here we make an info table of type 'CmmInfo'.  The concrete</span><span>
</span><span id="line-591"></span><span class="hs-comment">-- representation as a list of 'CmmAddr' is handled later</span><span>
</span><span id="line-592"></span><span class="hs-comment">-- in the pipeline by 'cmmToRawCmm'.</span><span>
</span><span id="line-593"></span><span class="hs-comment">-- When loading the free variables, a function closure pointer may be tagged,</span><span>
</span><span id="line-594"></span><span class="hs-comment">-- so we must take it into account.</span><span>
</span><span id="line-595"></span><span>
</span><span id="line-596"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#emitClosureProcAndInfoTable"><span class="hs-identifier hs-type">emitClosureProcAndInfoTable</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>                    </span><span class="hs-comment">-- top-level?</span><span>
</span><span id="line-597"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>                      </span><span class="hs-comment">-- name of the closure</span><span>
</span><span id="line-598"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Types.html#LambdaFormInfo"><span class="hs-identifier hs-type">LambdaFormInfo</span></a></span><span>
</span><span id="line-599"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.html#CmmInfoTable"><span class="hs-identifier hs-type">CmmInfoTable</span></a></span><span>
</span><span id="line-600"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-type">NonVoid</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>            </span><span class="hs-comment">-- incoming arguments</span><span>
</span><span id="line-601"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- function body</span><span>
</span><span id="line-602"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-603"></span><span id="emitClosureProcAndInfoTable"><span class="annot"><span class="annottext">emitClosureProcAndInfoTable :: Bool
-&gt; Id
-&gt; LambdaFormInfo
-&gt; CmmInfoTable
-&gt; [NonVoid Id]
-&gt; ((Int, LocalReg, [LocalReg]) -&gt; FCode ())
-&gt; FCode ()
</span><a href="GHC.StgToCmm.Layout.html#emitClosureProcAndInfoTable"><span class="hs-identifier hs-var hs-var">emitClosureProcAndInfoTable</span></a></span></span><span> </span><span id="local-6989586621681052984"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681052984"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span> </span><span id="local-6989586621681052983"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681052983"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681052982"><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681052982"><span class="hs-identifier hs-var">lf_info</span></a></span></span><span> </span><span id="local-6989586621681052981"><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="#local-6989586621681052981"><span class="hs-identifier hs-var">info_tbl</span></a></span></span><span> </span><span id="local-6989586621681052980"><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681052980"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621681052979"><span class="annot"><span class="annottext">(Int, LocalReg, [LocalReg]) -&gt; FCode ()
</span><a href="#local-6989586621681052979"><span class="hs-identifier hs-var">body</span></a></span></span><span>
</span><span id="line-604"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>   </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681052978"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681052978"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-605"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681052977"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681052977"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode Platform
</span><a href="GHC.StgToCmm.Monad.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-606"></span><span>        </span><span class="hs-comment">-- Bind the binder itself, but only if it's not a top-level</span><span>
</span><span id="line-607"></span><span>        </span><span class="hs-comment">-- binding. We need non-top let-bindings to refer to the</span><span>
</span><span id="line-608"></span><span>        </span><span class="hs-comment">-- top-level binding, which this binding would incorrectly shadow.</span><span>
</span><span id="line-609"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681052976"><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681052976"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681052984"><span class="hs-identifier hs-var">top_lvl</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; FCode LocalReg
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LocalReg -&gt; FCode LocalReg) -&gt; LocalReg -&gt; FCode LocalReg
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; NonVoid Id -&gt; LocalReg
</span><a href="GHC.StgToCmm.Env.html#idToReg"><span class="hs-identifier hs-var">idToReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681052977"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; NonVoid Id
forall a. a -&gt; NonVoid a
</span><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-var">NonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681052983"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-610"></span><span>                  </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">NonVoid Id -&gt; LambdaFormInfo -&gt; FCode LocalReg
</span><a href="GHC.StgToCmm.Env.html#bindToReg"><span class="hs-identifier hs-var">bindToReg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; NonVoid Id
forall a. a -&gt; NonVoid a
</span><a href="GHC.StgToCmm.Closure.html#NonVoid"><span class="hs-identifier hs-var">NonVoid</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681052983"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681052982"><span class="hs-identifier hs-var">lf_info</span></a></span><span>
</span><span id="line-611"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681052973"><span class="annot"><span class="annottext">node_points :: Bool
</span><a href="#local-6989586621681052973"><span class="hs-identifier hs-var hs-var">node_points</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; LambdaFormInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#nodeMustPointToIt"><span class="hs-identifier hs-var">nodeMustPointToIt</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681052978"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681052982"><span class="hs-identifier hs-var">lf_info</span></a></span><span>
</span><span id="line-612"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681052971"><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681052971"><span class="hs-identifier hs-var">arg_regs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[NonVoid Id] -&gt; FCode [LocalReg]
</span><a href="GHC.StgToCmm.Env.html#bindArgsToRegs"><span class="hs-identifier hs-var">bindArgsToRegs</span></a></span><span> </span><span class="annot"><span class="annottext">[NonVoid Id]
</span><a href="#local-6989586621681052980"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-613"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681052969"><span class="annot"><span class="annottext">args' :: [LocalReg]
</span><a href="#local-6989586621681052969"><span class="hs-identifier hs-var hs-var">args'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681052973"><span class="hs-identifier hs-var">node_points</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681052976"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="annot"><span class="annottext">LocalReg -&gt; [LocalReg] -&gt; [LocalReg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681052971"><span class="hs-identifier hs-var">arg_regs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681052971"><span class="hs-identifier hs-var">arg_regs</span></a></span><span>
</span><span id="line-614"></span><span>              </span><span id="local-6989586621681052968"><span class="annot"><span class="annottext">conv :: Convention
</span><a href="#local-6989586621681052968"><span class="hs-identifier hs-var hs-var">conv</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; LambdaFormInfo -&gt; Bool
</span><a href="GHC.StgToCmm.Closure.html#nodeMustPointToIt"><span class="hs-identifier hs-var">nodeMustPointToIt</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681052978"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">LambdaFormInfo
</span><a href="#local-6989586621681052982"><span class="hs-identifier hs-var">lf_info</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeNodeCall"><span class="hs-identifier hs-var">NativeNodeCall</span></a></span><span>
</span><span id="line-615"></span><span>                                                          </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="GHC.Cmm.Node.html#NativeDirectCall"><span class="hs-identifier hs-var">NativeDirectCall</span></a></span><span>
</span><span id="line-616"></span><span>              </span><span class="hs-special">(</span><span id="local-6989586621681052966"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681052966"><span class="hs-identifier hs-var">offset</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[GlobalReg]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CmmAGraph
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; Convention
-&gt; [LocalReg]
-&gt; [LocalReg]
-&gt; (Int, [GlobalReg], CmmAGraph)
</span><a href="GHC.Cmm.Graph.html#mkCallEntry"><span class="hs-identifier hs-var">mkCallEntry</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681052978"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681052968"><span class="hs-identifier hs-var">conv</span></a></span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681052969"><span class="hs-identifier hs-var">args'</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-617"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">CmmInfoTable -&gt; Convention -&gt; [LocalReg] -&gt; FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Layout.html#emitClosureAndInfoTable"><span class="hs-identifier hs-var">emitClosureAndInfoTable</span></a></span><span> </span><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="#local-6989586621681052981"><span class="hs-identifier hs-var">info_tbl</span></a></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681052968"><span class="hs-identifier hs-var">conv</span></a></span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681052969"><span class="hs-identifier hs-var">args'</span></a></span><span> </span><span class="annot"><span class="annottext">(FCode () -&gt; FCode ()) -&gt; FCode () -&gt; FCode ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Int, LocalReg, [LocalReg]) -&gt; FCode ()
</span><a href="#local-6989586621681052979"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681052966"><span class="hs-identifier hs-var">offset</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LocalReg
</span><a href="#local-6989586621681052976"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681052971"><span class="hs-identifier hs-var">arg_regs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-618"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-619"></span><span>
</span><span id="line-620"></span><span class="hs-comment">-- Data constructors need closures, but not with all the argument handling</span><span>
</span><span id="line-621"></span><span class="hs-comment">-- needed for functions. The shared part goes here.</span><span>
</span><span id="line-622"></span><span class="annot"><a href="GHC.StgToCmm.Layout.html#emitClosureAndInfoTable"><span class="hs-identifier hs-type">emitClosureAndInfoTable</span></a></span><span> </span><span class="hs-glyph">::</span><span>
</span><span id="line-623"></span><span>  </span><span class="annot"><a href="GHC.Cmm.html#CmmInfoTable"><span class="hs-identifier hs-type">CmmInfoTable</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Node.html#Convention"><span class="hs-identifier hs-type">Convention</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.Expr.html#LocalReg"><span class="hs-identifier hs-type">LocalReg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.StgToCmm.Monad.html#FCode"><span class="hs-identifier hs-type">FCode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-624"></span><span id="emitClosureAndInfoTable"><span class="annot"><span class="annottext">emitClosureAndInfoTable :: CmmInfoTable -&gt; Convention -&gt; [LocalReg] -&gt; FCode () -&gt; FCode ()
</span><a href="GHC.StgToCmm.Layout.html#emitClosureAndInfoTable"><span class="hs-identifier hs-var hs-var">emitClosureAndInfoTable</span></a></span></span><span> </span><span id="local-6989586621681052964"><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="#local-6989586621681052964"><span class="hs-identifier hs-var">info_tbl</span></a></span></span><span> </span><span id="local-6989586621681052963"><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681052963"><span class="hs-identifier hs-var">conv</span></a></span></span><span> </span><span id="local-6989586621681052962"><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681052962"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621681052961"><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681052961"><span class="hs-identifier hs-var">body</span></a></span></span><span>
</span><span id="line-625"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681052960"><span class="annot"><span class="annottext">CmmAGraphScoped
</span><a href="#local-6989586621681052960"><span class="hs-identifier hs-var">blks</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FCode () -&gt; FCode ((), CmmAGraphScoped)
forall a. FCode a -&gt; FCode (a, CmmAGraphScoped)
</span><a href="GHC.StgToCmm.Monad.html#getCodeScoped"><span class="hs-identifier hs-var">getCodeScoped</span></a></span><span> </span><span class="annot"><span class="annottext">FCode ()
</span><a href="#local-6989586621681052961"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-626"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681052958"><span class="annot"><span class="annottext">entry_lbl :: CLabel
</span><a href="#local-6989586621681052958"><span class="hs-identifier hs-var hs-var">entry_lbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CLabel -&gt; CLabel
</span><a href="GHC.Cmm.CLabel.html#toEntryLbl"><span class="hs-identifier hs-var">toEntryLbl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmInfoTable -&gt; CLabel
</span><a href="GHC.Cmm.html#cit_lbl"><span class="hs-identifier hs-var hs-var">cit_lbl</span></a></span><span> </span><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="#local-6989586621681052964"><span class="hs-identifier hs-var">info_tbl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-627"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Convention
-&gt; Maybe CmmInfoTable
-&gt; CLabel
-&gt; [LocalReg]
-&gt; CmmAGraphScoped
-&gt; FCode ()
</span><a href="GHC.StgToCmm.Monad.html#emitProcWithConvention"><span class="hs-identifier hs-var">emitProcWithConvention</span></a></span><span> </span><span class="annot"><span class="annottext">Convention
</span><a href="#local-6989586621681052963"><span class="hs-identifier hs-var">conv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmInfoTable -&gt; Maybe CmmInfoTable
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">CmmInfoTable
</span><a href="#local-6989586621681052964"><span class="hs-identifier hs-var">info_tbl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681052958"><span class="hs-identifier hs-var">entry_lbl</span></a></span><span> </span><span class="annot"><span class="annottext">[LocalReg]
</span><a href="#local-6989586621681052962"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">CmmAGraphScoped
</span><a href="#local-6989586621681052960"><span class="hs-identifier hs-var">blks</span></a></span><span>
</span><span id="line-628"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-629"></span></pre></body></html>